Blame SOURCES/0180-IPA-process_members-add-ghosts-only-once.patch

905b4d
From 11277f49cabdf4b7b49dba05dc4db9c2e5ffe53b Mon Sep 17 00:00:00 2001
905b4d
From: Sumit Bose <sbose@redhat.com>
905b4d
Date: Wed, 21 Jan 2015 16:33:59 +0100
905b4d
Subject: [PATCH 180/181] IPA: process_members() add ghosts only once
905b4d
905b4d
Since ghost entries might not be properly removed on the IPA server
905b4d
(https://fedorahosted.org/sssd/ticket/2567) chances are that during
905b4d
extdom group lookups a single user is returned multiple time. This patch
905b4d
removes the duplicates before trying to write the data to the cache.
905b4d
905b4d
Related to https://fedorahosted.org/sssd/ticket/2159
905b4d
905b4d
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
905b4d
(cherry picked from commit 60f11e2fa1f63cd40ebace525ad823b0360fac94)
905b4d
---
905b4d
 src/providers/ipa/ipa_s2n_exop.c | 6 ++++--
905b4d
 1 file changed, 4 insertions(+), 2 deletions(-)
905b4d
905b4d
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
905b4d
index 997d0dce8d3225f83bbce506d349e4a8705e1e95..6f8d5687d66717ba62e83da27dd6b23bc12151fb 100644
905b4d
--- a/src/providers/ipa/ipa_s2n_exop.c
905b4d
+++ b/src/providers/ipa/ipa_s2n_exop.c
905b4d
@@ -1299,8 +1299,10 @@ static errno_t process_members(struct sss_domain_info *domain,
905b4d
                 DEBUG(SSSDBG_TRACE_ALL, "Adding ghost member [%s]\n",
905b4d
                                         members[c]);
905b4d
 
905b4d
-                ret = sysdb_attrs_add_string(group_attrs, SYSDB_GHOST,
905b4d
-                                             members[c]);
905b4d
+                /* There were cases where the server returned the same user
905b4d
+                 * multiple times */
905b4d
+                ret = sysdb_attrs_add_string_safe(group_attrs, SYSDB_GHOST,
905b4d
+                                                  members[c]);
905b4d
                 if (ret != EOK) {
905b4d
                     DEBUG(SSSDBG_OP_FAILURE,
905b4d
                           "sysdb_attrs_add_string failed.\n");
905b4d
-- 
905b4d
2.1.0
905b4d