dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From 11277f49cabdf4b7b49dba05dc4db9c2e5ffe53b Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Wed, 21 Jan 2015 16:33:59 +0100
Subject: [PATCH 180/181] IPA: process_members() add ghosts only once

Since ghost entries might not be properly removed on the IPA server
(https://fedorahosted.org/sssd/ticket/2567) chances are that during
extdom group lookups a single user is returned multiple time. This patch
removes the duplicates before trying to write the data to the cache.

Related to https://fedorahosted.org/sssd/ticket/2159

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
(cherry picked from commit 60f11e2fa1f63cd40ebace525ad823b0360fac94)
---
 src/providers/ipa/ipa_s2n_exop.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
index 997d0dce8d3225f83bbce506d349e4a8705e1e95..6f8d5687d66717ba62e83da27dd6b23bc12151fb 100644
--- a/src/providers/ipa/ipa_s2n_exop.c
+++ b/src/providers/ipa/ipa_s2n_exop.c
@@ -1299,8 +1299,10 @@ static errno_t process_members(struct sss_domain_info *domain,
                 DEBUG(SSSDBG_TRACE_ALL, "Adding ghost member [%s]\n",
                                         members[c]);
 
-                ret = sysdb_attrs_add_string(group_attrs, SYSDB_GHOST,
-                                             members[c]);
+                /* There were cases where the server returned the same user
+                 * multiple times */
+                ret = sysdb_attrs_add_string_safe(group_attrs, SYSDB_GHOST,
+                                                  members[c]);
                 if (ret != EOK) {
                     DEBUG(SSSDBG_OP_FAILURE,
                           "sysdb_attrs_add_string failed.\n");
-- 
2.1.0