diff options
author | Günther Deschner <gd@samba.org> | 2006-09-20 00:15:50 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:00:49 -0500 |
commit | 7db6ce295afbedfada7b207ad56566d2195a0d21 (patch) | |
tree | 4e2ecc9292b55d6372acf005416a80f770f03c27 /source/groupdb | |
parent | f3ff07404650e4b9846367ba981764b1a879bca9 (diff) | |
download | samba-7db6ce295afbedfada7b207ad56566d2195a0d21.tar.gz samba-7db6ce295afbedfada7b207ad56566d2195a0d21.tar.xz samba-7db6ce295afbedfada7b207ad56566d2195a0d21.zip |
r18703: Fix the annoying effect that happens when nscd is running:
We usually do not get the results from user/group script modifications
immediately. A lot of users do add nscd restart/refresh commands into
their scripts to workaround that while we could flush the nscd caches
directly using libnscd.
Guenther
Diffstat (limited to 'source/groupdb')
-rw-r--r-- | source/groupdb/mapping.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/source/groupdb/mapping.c b/source/groupdb/mapping.c index 3d7b9f3f91a..1d7934e9bf3 100644 --- a/source/groupdb/mapping.c +++ b/source/groupdb/mapping.c @@ -878,9 +878,12 @@ int smb_create_group(const char *unix_group, gid_t *new_gid) pstring_sub(add_script, "%g", unix_group); ret = smbrun(add_script, &fd); DEBUG(ret ? 0 : 3,("smb_create_group: Running the command `%s' gave %d\n",add_script,ret)); + if (ret == 0) { + smb_nscd_flush_group_cache(); + } if (ret != 0) return ret; - + if (fd != 0) { fstring output; @@ -920,6 +923,9 @@ int smb_delete_group(const char *unix_group) pstring_sub(del_script, "%g", unix_group); ret = smbrun(del_script,NULL); DEBUG(ret ? 0 : 3,("smb_delete_group: Running the command `%s' gave %d\n",del_script,ret)); + if (ret == 0) { + smb_nscd_flush_group_cache(); + } return ret; } @@ -944,6 +950,9 @@ int smb_set_primary_group(const char *unix_group, const char* unix_user) flush_pwnam_cache(); DEBUG(ret ? 0 : 3,("smb_set_primary_group: " "Running the command `%s' gave %d\n",add_script,ret)); + if (ret == 0) { + smb_nscd_flush_group_cache(); + } return ret; } @@ -967,6 +976,9 @@ int smb_add_user_group(const char *unix_group, const char *unix_user) pstring_sub(add_script, "%u", unix_user); ret = smbrun(add_script,NULL); DEBUG(ret ? 0 : 3,("smb_add_user_group: Running the command `%s' gave %d\n",add_script,ret)); + if (ret == 0) { + smb_nscd_flush_group_cache(); + } return ret; } @@ -990,6 +1002,9 @@ int smb_delete_user_group(const char *unix_group, const char *unix_user) pstring_sub(del_script, "%u", unix_user); ret = smbrun(del_script,NULL); DEBUG(ret ? 0 : 3,("smb_delete_user_group: Running the command `%s' gave %d\n",del_script,ret)); + if (ret == 0) { + smb_nscd_flush_group_cache(); + } return ret; } |