[SSSD] [PATCH] Only try to relink ghost users if we're not enumerating

Jakub Hrozek jhrozek at redhat.com
Mon Apr 29 13:03:14 UTC 2013


https://fedorahosted.org/sssd/ticket/1893

When SSSD is not enumerating (which is the default), we are trying to
link any "ghost" entries with a newly created user entry. However, when
enumeration is on, this means a spurious search on adding any user.
-------------- next part --------------
>From 9fea20555416fcf57c7fd58b81a91ec710087816 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Mon, 29 Apr 2013 14:37:27 +0200
Subject: [PATCH] Only try to relink ghost users if we're not enumerating

https://fedorahosted.org/sssd/ticket/1893

When SSSD is not enumerating (which is the default), we are trying to
link any "ghost" entries with a newly created user entry. However, when
enumeration is on, this means a spurious search on adding any user.
---
 src/db/sysdb_ops.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 1f27af8db02ffcce3f62103a92e57528dc4370ab..c758e727f888fc63098915db973dfe0a1285faa1 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -1199,10 +1199,14 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
     ret = sysdb_set_user_attr(sysdb, domain, name, attrs, SYSDB_MOD_REP);
     if (ret) goto done;
 
-    /* remove all ghost users */
-    ret = sysdb_remove_ghostattr_from_groups(sysdb, domain,
-                                             orig_dn, attrs, name);
-    if (ret) goto done;
+    if (domain->enumerate == false) {
+        /* If we're not enumerating, previous getgr{nam,gid} calls might
+         * have stored ghost users into the cache, so we need to link them
+         * with the newly-created user entry */
+        ret = sysdb_remove_ghostattr_from_groups(sysdb, domain,
+                                                 orig_dn, attrs, name);
+        if (ret) goto done;
+    }
 
     ret = EOK;
 
-- 
1.8.1.4



More information about the sssd-devel mailing list