summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-12-02 16:04:50 -0500
committerStephen Gallagher <sgallagh@redhat.com>2009-12-03 10:26:36 -0500
commitc5a98a8b6f8dfe203f84580f13695b3726336e7c (patch)
treeb289042068b6a15b7b9152cbb21031436363a61b /server
parent532b8126067b61332e4d608f8e4854da9d3c93ae (diff)
downloadsssd-c5a98a8b6f8dfe203f84580f13695b3726336e7c.tar.gz
sssd-c5a98a8b6f8dfe203f84580f13695b3726336e7c.tar.xz
sssd-c5a98a8b6f8dfe203f84580f13695b3726336e7c.zip
Fix memberof plugin
A loop was badly built and was skipping entries. This left some memberof attributes in place that should have been removed.
Diffstat (limited to 'server')
-rw-r--r--server/ldb_modules/memberof.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/server/ldb_modules/memberof.c b/server/ldb_modules/memberof.c
index bd32d0acd..76914133e 100644
--- a/server/ldb_modules/memberof.c
+++ b/server/ldb_modules/memberof.c
@@ -82,7 +82,7 @@ struct mbof_del_operation {
struct mbof_del_operation *parent;
struct mbof_del_operation **children;
int num_children;
- int cur_child;
+ int next_child;
struct ldb_dn *entry_dn;
@@ -1760,23 +1760,26 @@ static int mbof_del_get_next(struct mbof_del_operation *delop,
/* Find next one */
for (top = delop; top; top = top->parent) {
- if (top->num_children &&
- top->cur_child < top->num_children) {
+ if (top->num_children == 0 || top->next_child >= top->num_children) {
+ /* no children, go for next one */
+ continue;
+ }
- cop = top->children[top->cur_child];
- top->cur_child++;
+ while (top->next_child < top->num_children) {
+ cop = top->children[top->next_child];
+ top->next_child++;
/* verify this operation has not already been performed */
for (tmp = del_ctx->history; tmp; tmp = tmp->next) {
- if (ldb_dn_compare(tmp->dn, cop->entry_dn) == 0) break;
+ if (ldb_dn_compare(tmp->dn, cop->entry_dn) == 0) {
+ break;
+ }
}
- if (tmp) {
- /* it's a dup */
- continue;
+ if (tmp == NULL) {
+ /* and return the current one */
+ *nextop = cop;
+ return LDB_SUCCESS;
}
-
- *nextop = cop;
- return LDB_SUCCESS;
}
}