summaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/db')
-rw-r--r--src/db/sysdb_ops.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 1f27af8db..45a7265c9 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -1199,10 +1199,15 @@ 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;