This was a tricky bug, thanks for finding it out Jakub.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York
>From 56bf16770ff467316cc50c8a30880774ae510427 Mon Sep 17 00:00:00 2001
From: Simo Sorce <[email protected]>
Date: Wed, 10 Mar 2010 10:25:03 -0500
Subject: [PATCH] Fix memberof calculation when deleting groups

With complex hierarchies it could happen that the group just deleted was
re-added by mistake to the list of groups a user is member of, causing the user
to have a stray memberof value in its entry.
---
 src/ldb_modules/memberof.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/ldb_modules/memberof.c b/src/ldb_modules/memberof.c
index e0a241a..c3f5763 100644
--- a/src/ldb_modules/memberof.c
+++ b/src/ldb_modules/memberof.c
@@ -1876,6 +1876,11 @@ static int mbof_del_anc_callback(struct ldb_request *req,
                     talloc_free(valdn);
                     continue;
                 }
+                /* do not re-add the original deleted entry by mistake */
+                if (ldb_dn_compare(valdn, del_ctx->first->entry_dn) == 0) {
+                    talloc_free(valdn);
+                    continue;
+                }
                 new_list->dns = talloc_realloc(new_list,
                                                new_list->dns,
                                                struct ldb_dn *,
-- 
1.6.6.1

_______________________________________________
sssd-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to