dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0148-IPA-do-not-try-to-add-override-gid-twice.patch

905b4d
From b52b26176c92f3b06dba5598428c70c0cde13fd1 Mon Sep 17 00:00:00 2001
905b4d
From: Sumit Bose <sbose@redhat.com>
905b4d
Date: Tue, 2 Dec 2014 21:10:01 +0100
905b4d
Subject: [PATCH 1/2] IPA: do not try to add override gid twice
905b4d
MIME-Version: 1.0
905b4d
Content-Type: text/plain; charset=UTF-8
905b4d
Content-Transfer-Encoding: 8bit
905b4d
905b4d
By default user and group overrides use the same attribute name for the
905b4d
GID and this cause SSSD machinery to add the same value twice which
905b4d
cause an error in ldb_add() or ldm_modify().
905b4d
905b4d
Related to https://fedorahosted.org/sssd/ticket/2514
905b4d
905b4d
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
905b4d
---
905b4d
 src/db/sysdb_views.c | 8 +++++++-
905b4d
 1 file changed, 7 insertions(+), 1 deletion(-)
905b4d
905b4d
diff --git a/src/db/sysdb_views.c b/src/db/sysdb_views.c
905b4d
index 8cc279af6c72f3e7ab2917d997f84a33a05e91b9..c735a7bd8588a80743d40438d010db5912f47bb5 100644
905b4d
--- a/src/db/sysdb_views.c
905b4d
+++ b/src/db/sysdb_views.c
905b4d
@@ -525,8 +525,14 @@ errno_t sysdb_store_override(struct sss_domain_info *domain,
905b4d
             goto done;
905b4d
         }
905b4d
 
905b4d
-        /* TODO: add nameAlias for case-insentitive searches */
905b4d
         for (c = 0; c < attrs->num; c++) {
905b4d
+            /* Set num_values to 1 because by default user and group overrides
905b4d
+             * use the same attribute name for the GID and this cause SSSD
905b4d
+             * machinery to add the same value twice */
905b4d
+            if (attrs->a[c].num_values > 1
905b4d
+                    && strcmp(attrs->a[c].name, SYSDB_GIDNUM) == 0) {
905b4d
+                attrs->a[c].num_values = 1;
905b4d
+            }
905b4d
             msg->elements[c] = attrs->a[c];
905b4d
             msg->elements[c].flags = LDB_FLAG_MOD_ADD;
905b4d
         }
905b4d
-- 
905b4d
1.9.3
905b4d