diff options
author | Sumit Bose <sbose@redhat.com> | 2014-11-12 12:43:23 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-11-25 19:38:43 +0100 |
commit | fe2ab0d67fe8c66fb6352e9d8f845bb46d1848cb (patch) | |
tree | 047a12fa007f54f81bc4c321075782d38301c86a /src/db/sysdb_views.c | |
parent | ff7481ff6f75d92470cff56632ad06ff7f10e895 (diff) | |
download | sssd-fe2ab0d67fe8c66fb6352e9d8f845bb46d1848cb.tar.gz sssd-fe2ab0d67fe8c66fb6352e9d8f845bb46d1848cb.tar.xz sssd-fe2ab0d67fe8c66fb6352e9d8f845bb46d1848cb.zip |
sysdb: add sysdb_delete_view_tree()
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src/db/sysdb_views.c')
-rw-r--r-- | src/db/sysdb_views.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/db/sysdb_views.c b/src/db/sysdb_views.c index 27b58701f..e17321455 100644 --- a/src/db/sysdb_views.c +++ b/src/db/sysdb_views.c @@ -180,6 +180,40 @@ done: return ret; } +errno_t sysdb_delete_view_tree(struct sysdb_ctx *sysdb, const char *view_name) +{ + struct ldb_dn *dn; + TALLOC_CTX *tmp_ctx; + int ret; + + tmp_ctx = talloc_new(NULL); + if (tmp_ctx == NULL) { + DEBUG(SSSDBG_OP_FAILURE, "talloc_new failed.\n"); + return ENOMEM; + } + + dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_VIEW_SEARCH_BASE, + view_name); + if (dn == NULL) { + DEBUG(SSSDBG_OP_FAILURE, "ldb_dn_new_fmt failed.\n"); + ret = EIO; + goto done; + } + + ret = sysdb_delete_recursive(sysdb, dn, true); + if (ret != EOK) { + DEBUG(SSSDBG_OP_FAILURE, "sysdb_delete_recursive failed.\n"); + goto done; + } + + ret = EOK; + +done: + talloc_free(tmp_ctx); + + return ret; +} + static errno_t add_name_and_aliases_for_name_override(struct sss_domain_info *domain, struct sysdb_attrs *attrs, |