summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-09-06 17:27:51 +0200
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-09-07 08:37:25 +0200
commit5107f6fd0acc7d8e5a69bd838f44f74f0a094290 (patch)
tree6757900346a8e674d6b0b6fea3bfb8d2c5f904fb /source4/dsdb/samdb/ldb_modules
parentfc90586a4255db717e344eaf7d7f7b2d7b89b571 (diff)
downloadsamba-5107f6fd0acc7d8e5a69bd838f44f74f0a094290.tar.gz
samba-5107f6fd0acc7d8e5a69bd838f44f74f0a094290.tar.bz2
samba-5107f6fd0acc7d8e5a69bd838f44f74f0a094290.zip
s4:subtree delete module - Cosmetic adaptions
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules')
-rw-r--r--source4/dsdb/samdb/ldb_modules/subtree_delete.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/subtree_delete.c b/source4/dsdb/samdb/ldb_modules/subtree_delete.c
index 55a24549dd..241cc5f7d6 100644
--- a/source4/dsdb/samdb/ldb_modules/subtree_delete.c
+++ b/source4/dsdb/samdb/ldb_modules/subtree_delete.c
@@ -69,8 +69,8 @@ static int subtree_delete_search_callback(struct ldb_request *req,
ldb = ldb_module_get_ctx(ac->module);
if (!ares) {
- return ldb_module_done(ac->req, NULL, NULL,
- LDB_ERR_OPERATIONS_ERROR);
+ ret = LDB_ERR_OPERATIONS_ERROR;
+ goto done;
}
if (ares->error != LDB_SUCCESS) {
return ldb_module_done(ac->req, ares->controls,
@@ -79,21 +79,23 @@ static int subtree_delete_search_callback(struct ldb_request *req,
switch (ares->type) {
case LDB_REPLY_ENTRY:
+ /* count entry */
+ ++(ac->num_children);
talloc_free(ares);
- ac->num_children++;
+ ret = LDB_SUCCESS;
break;
case LDB_REPLY_REFERRAL:
-
/* ignore */
talloc_free(ares);
+ ret = LDB_SUCCESS;
break;
case LDB_REPLY_DONE:
+ talloc_free(ares);
if (ac->num_children > 0) {
- talloc_free(ares);
ldb_asprintf_errstring(ldb,
"Cannot delete %s, not a leaf node "
"(has %d children)\n",
@@ -105,13 +107,14 @@ static int subtree_delete_search_callback(struct ldb_request *req,
/* ok no children, let the original request through */
ret = ldb_next_request(ac->module, ac->req);
- if (ret != LDB_SUCCESS) {
- return ldb_module_done(ac->req, NULL, NULL, ret);
- }
+ break;
+ }
- /* free our own context we are not going to be called back */
- talloc_free(ac);
+done:
+ if (ret != LDB_SUCCESS) {
+ return ldb_module_done(ac->req, NULL, NULL, ret);
}
+
return LDB_SUCCESS;
}
@@ -122,7 +125,9 @@ static int subtree_delete(struct ldb_module *module, struct ldb_request *req)
struct ldb_request *search_req;
struct subtree_delete_context *ac;
int ret;
- if (ldb_dn_is_special(req->op.rename.olddn)) { /* do not manipulate our control entries */
+
+ if (ldb_dn_is_special(req->op.rename.olddn)) {
+ /* do not manipulate our control entries */
return ldb_next_request(module, req);
}