diff options
author | Andrew Bartlett <abartlet@samba.org> | 2018-05-28 10:56:21 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2018-05-30 04:23:27 +0200 |
commit | d346e2ee6b154a0dcf4072a3fc1fd6007369a69d (patch) | |
tree | ff7f28217b450c6aefa664ab020b5f8d2a605bd8 /source4 | |
parent | 16a0582644800fecb52adad05f43014df5607314 (diff) | |
download | samba-d346e2ee6b154a0dcf4072a3fc1fd6007369a69d.tar.gz |
dsdb: Remove sort from subtree_delete and add comments.
The sort was written back when the module did not operate recursivly
over the tree. Now it is just confusing, so replace with useful
comments.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/subtree_delete.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/subtree_delete.c b/source4/dsdb/samdb/ldb_modules/subtree_delete.c index b1f87f77b54..24211b61ab3 100644 --- a/source4/dsdb/samdb/ldb_modules/subtree_delete.c +++ b/source4/dsdb/samdb/ldb_modules/subtree_delete.c @@ -38,19 +38,6 @@ #include "dsdb/common/util.h" -static int subtree_delete_sort(struct ldb_message **m1, - struct ldb_message **m2, - void *private_data) -{ - struct ldb_dn *dn1 = (*m1)->dn; - struct ldb_dn *dn2 = (*m2)->dn; - - /* - * This sorts in tree order, children first - */ - return ldb_dn_compare(dn1, dn2); -} - static int subtree_delete(struct ldb_module *module, struct ldb_request *req) { static const char * const attrs[] = { NULL }; @@ -93,12 +80,6 @@ static int subtree_delete(struct ldb_module *module, struct ldb_request *req) } /* - * First we sort the results from the leaf to the root - */ - LDB_TYPESAFE_QSORT(res->msgs, res->count, NULL, - subtree_delete_sort); - - /* * we need to start from the top since other LDB modules could * enforce constraints (eg "objectclass" and "samldb" do so). * @@ -113,6 +94,12 @@ static int subtree_delete(struct ldb_module *module, struct ldb_request *req) flags |= DSDB_MODIFY_RELAX; } + /* + * The net result of this code is that the leaf nodes are + * deleted first, as the parent is only deleted once these + * calls (and the delete calls recursive within these) + * complete. + */ for (i = 0; i < res->count; i++) { ret = dsdb_module_del(module, res->msgs[i]->dn, flags, req); if (ret != LDB_SUCCESS) { |