#111
I found this while closely going through the file to implement ghost users. 
After discovering this, I re-checked it twice to be sure. To enter the block 
of code, it would require RFC2307 and populate_members set to false.

But when you go through the file, the only place where sdap_save_groups() is 
called for RFC2307 is in sdap_get_groups_done() and it is called with 
populate_users = true.

#112
Because of the change in previous patch, there is only one place where this 
function is called and it is bound with RFC230bis.

Thanks
Jan
From bd6b5aa7cb132c5b5d74f90ab06e3cf9f68784ee Mon Sep 17 00:00:00 2001
From: Jan Zeleny <jzel...@redhat.com>
Date: Tue, 17 Apr 2012 04:23:36 -0400
Subject: [PATCH 1/2] Removed a block of dead code in sdap_async_groups.c

---
 src/providers/ldap/sdap_async_groups.c |   21 +--------------------
 1 files changed, 1 insertions(+), 20 deletions(-)

diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index aad2990c5a26e2d8ce720097d6afb9724cc4b993..e616c2794d9da290f622025bd3aecb65ed09e5c8 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -212,7 +212,6 @@ static int sdap_save_group(TALLOC_CTX *memctx,
                            struct sdap_options *opts,
                            struct sss_domain_info *dom,
                            struct sysdb_attrs *attrs,
-                           bool store_members,
                            bool populate_members,
                            char **_usn_value,
                            time_t now)
@@ -328,24 +327,6 @@ static int sdap_save_group(TALLOC_CTX *memctx,
         }
         el->values = el1->values;
         el->num_values = el1->num_values;
-    } else if (store_members) {
-        ret = sysdb_attrs_get_el(attrs,
-                        opts->group_map[SDAP_AT_GROUP_MEMBER].sys_name, &el);
-        if (ret != EOK) {
-            goto fail;
-        }
-        if (el->num_values == 0) {
-            DEBUG(7, ("No members for group [%s]\n", name));
-
-        } else {
-            DEBUG(7, ("Adding member users to group [%s]\n", name));
-
-            ret = sdap_fill_memberships(group_attrs, ctx, opts, dom,
-                                        el->values, el->num_values);
-            if (ret) {
-                goto fail;
-            }
-        }
     }
 
     ret = sdap_save_all_names(name, attrs, !dom->case_sensitive, group_attrs);
@@ -502,7 +483,7 @@ static int sdap_save_groups(TALLOC_CTX *memctx,
         /* if 2 pass savemembers = false */
         ret = sdap_save_group(tmpctx, sysdb,
                               opts, dom, groups[i],
-                              (!twopass), populate_members, &usn_value, now);
+                              populate_members, &usn_value, now);
 
         /* Do not fail completely on errors.
          * Just report the failure to save and go on */
-- 
1.7.6.5

From 9f370dfece05dbffd944e46c52a919651af8bec0 Mon Sep 17 00:00:00 2001
From: Jan Zeleny <jzel...@redhat.com>
Date: Tue, 17 Apr 2012 04:47:21 -0400
Subject: [PATCH 2/2] Removed unused block of code is sdap_fill_memberships()

---
 src/providers/ldap/sdap_async_groups.c |   94 +++++++++++---------------------
 1 files changed, 33 insertions(+), 61 deletions(-)

diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index e616c2794d9da290f622025bd3aecb65ed09e5c8..b19e2b67005ecae4464ae10a7d75da5fa6e2b77b 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -102,70 +102,42 @@ static int sdap_fill_memberships(struct sysdb_attrs *group_attrs,
     int i, j;
     int ret;
 
-    switch (opts->schema_type) {
-    case SDAP_SCHEMA_RFC2307:
-        DEBUG(9, ("[RFC2307 Schema]\n"));
-
-        ret = sysdb_attrs_users_from_ldb_vals(group_attrs, SYSDB_MEMBER,
-                                              domain->name,
-                                              values, num_values);
-        if (ret) {
-            goto done;
-        }
-
-        break;
-
-    case SDAP_SCHEMA_RFC2307BIS:
-    case SDAP_SCHEMA_IPA_V1:
-    case SDAP_SCHEMA_AD:
-        DEBUG(9, ("[IPA or AD Schema]\n"));
-
-        ret = sysdb_attrs_get_el(group_attrs, SYSDB_MEMBER, &el);
-        if (ret) {
-            goto done;
-        }
-
-        /* Just allocate both big enough to contain all members for now */
-        el->values = talloc_realloc(el, el->values, struct ldb_val,
-                                    el->num_values + num_values);
-        if (!el->values) {
-            ret = ENOMEM;
-            goto done;
-        }
-
-        for (i = 0, j = el->num_values; i < num_values; i++) {
-
-            /* sync search entry with this as origDN */
-            ret = sdap_find_entry_by_origDN(el->values, ctx, domain,
-                                            (char *)values[i].data,
-                                            (char **)&el->values[j].data);
-            if (ret != EOK) {
-                if (ret != ENOENT) {
-                    goto done;
-                }
-
-                DEBUG(7, ("    member #%d (%s): not found!\n",
-                          i, (char *)values[i].data));
-            } else {
-                DEBUG(7, ("    member #%d (%s): [%s]\n",
-                          i, (char *)values[i].data,
-                          (char *)el->values[j].data));
-
-                el->values[j].length = strlen((char *)el->values[j].data);
-                j++;
+    ret = sysdb_attrs_get_el(group_attrs, SYSDB_MEMBER, &el);
+    if (ret) {
+        goto done;
+    }
+
+    /* Just allocate both big enough to contain all members for now */
+    el->values = talloc_realloc(el, el->values, struct ldb_val,
+                                el->num_values + num_values);
+    if (!el->values) {
+        ret = ENOMEM;
+        goto done;
+    }
+
+    for (i = 0, j = el->num_values; i < num_values; i++) {
+
+        /* sync search entry with this as origDN */
+        ret = sdap_find_entry_by_origDN(el->values, ctx, domain,
+                                        (char *)values[i].data,
+                                        (char **)&el->values[j].data);
+        if (ret != EOK) {
+            if (ret != ENOENT) {
+                goto done;
             }
+
+            DEBUG(7, ("    member #%d (%s): not found!\n",
+                      i, (char *)values[i].data));
+        } else {
+            DEBUG(7, ("    member #%d (%s): [%s]\n",
+                      i, (char *)values[i].data,
+                      (char *)el->values[j].data));
+
+            el->values[j].length = strlen((char *)el->values[j].data);
+            j++;
         }
-        el->num_values = j;
-
-        break;
-
-    default:
-        DEBUG(0, ("FATAL ERROR: Unhandled schema type! (%d)\n",
-                  opts->schema_type));
-        ret = EFAULT;
-        goto done;
     }
-
+    el->num_values = j;
     ret = EOK;
 
 done:
-- 
1.7.6.5

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to