diff options
author | Simo Sorce <ssorce@redhat.com> | 2009-12-02 16:04:50 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-12-03 10:26:21 -0500 |
commit | 7fe612581b8024cba70155c5ae0859cef26fda06 (patch) | |
tree | 32f154ddf807b9b09330650e361ec2567bf42f97 | |
parent | bb4f29cd71bd7586c2fb2de2c7b2b1c9d21d1c91 (diff) | |
download | sssd-7fe612581b8024cba70155c5ae0859cef26fda06.tar.gz sssd-7fe612581b8024cba70155c5ae0859cef26fda06.tar.bz2 sssd-7fe612581b8024cba70155c5ae0859cef26fda06.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.
-rw-r--r-- | server/ldb_modules/memberof.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/server/ldb_modules/memberof.c b/server/ldb_modules/memberof.c index bd32d0ac..76914133 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; } } |