mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
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>
This commit is contained in:
parent
16a0582644
commit
d346e2ee6b
@ -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 };
|
||||
@ -92,12 +79,6 @@ static int subtree_delete(struct ldb_module *module, struct ldb_request *req)
|
||||
return LDB_ERR_NOT_ALLOWED_ON_NON_LEAF;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user