From 3496396e440377bca34887c0b271beb67db7c01d Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Tue, 2 Dec 2014 21:10:01 +0100 Subject: [PATCH 1/2] IPA: do not try to add override gid twice 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 --- 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 8cc279af6c72f3e7ab2917d997f84a33a05e91b9..c735a7bd8588a80743d40438d010db5912f47bb5 100644 --- a/src/db/sysdb_views.c +++ b/src/db/sysdb_views.c @@ -525,8 +525,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