sssd/0025-IPA-do-not-try-to-add-...

43 lines
1.6 KiB
Diff

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