[SSSD] [PATCH] SDAP: use DN to update entry

Sumit Bose sbose at redhat.com
Wed May 6 08:16:15 UTC 2015


Hi,

I found this while inspecting log files from
https://fedorahosted.org/sssd/ticket/2591 . My hope is that it fixes the
issue described in the ticket completely but since I cannot reproduce the
specific issue I cannot say this for sure.

bye,
Sumit
-------------- next part --------------
From 56818976013d9fc6650b4f7d85976af275a3938f Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Thu, 12 Mar 2015 12:46:31 +0100
Subject: [PATCH] SDAP: use DN to update entry

sdap_nested_group_populate_users() has code to handle user name changes.
It updates the SYSDB_NAME attribute. This attribute is also used in the
RDN but changing the attribute in the object does not change the DN
hence the DN still contains the old name. Currently
sysdb_set_user_attr() was used to update the entry which creates the DN
based on the give name. This will fail if the name is changed for a
second time. Since the DN is already available in the search result it
is more reliable to use it directly with sysdb_set_entry_attr().

Related to https://fedorahosted.org/sssd/ticket/2591
---
 src/providers/ldap/sdap_async_groups.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index fb1912d2b4fae1bdaf5f94d8f72c8f8deca2b17f..73caa9b5bd662477cd29b5220f6b437991831578 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -2467,7 +2467,8 @@ static errno_t sdap_nested_group_populate_users(TALLOC_CTX *mem_ctx,
 
             ret = sysdb_attrs_add_string(attrs, SYSDB_NAME, username);
             if (ret) goto done;
-            ret = sysdb_set_user_attr(user_dom, sysdb_name, attrs, SYSDB_MOD_REP);
+            ret = sysdb_set_entry_attr(user_dom->sysdb, msgs[0]->dn, attrs,
+                                       SYSDB_MOD_REP);
             if (ret != EOK) goto done;
         } else {
             key.type = HASH_KEY_STRING;
-- 
2.1.0



More information about the sssd-devel mailing list