summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-09-20 00:15:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:00:49 -0500
commita3e1f7e44d2d6a5ef801badc189b3dcf19dc72d9 (patch)
tree67dab5b2cd86ec9a19a77af60cadfd236d2d878e /source3/lib/util.c
parent47bb2e183961c7b9726002c6747ec3289898d043 (diff)
downloadsamba-a3e1f7e44d2d6a5ef801badc189b3dcf19dc72d9.tar.gz
samba-a3e1f7e44d2d6a5ef801badc189b3dcf19dc72d9.tar.bz2
samba-a3e1f7e44d2d6a5ef801badc189b3dcf19dc72d9.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 (This used to be commit 7db6ce295afbedfada7b207ad56566d2195a0d21)
Diffstat (limited to 'source3/lib/util.c')
-rw-r--r--source3/lib/util.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index e04ed977bb..2391566e6c 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -3017,3 +3017,24 @@ int this_is_smp(void)
return 0;
#endif
}
+
+static void smb_nscd_flush_cache(const char *service)
+{
+#ifdef HAVE_NSCD_FLUSH_CACHE
+ if (!nscd_flush_cache(service)) {
+ DEBUG(10,("failed to flush nscd cache for '%s' service: %s. "
+ "Is nscd running?\n",
+ service, strerror(errno)));
+ }
+#endif
+}
+
+void smb_nscd_flush_user_cache(void)
+{
+ return smb_nscd_flush_cache("passwd");
+}
+
+void smb_nscd_flush_group_cache(void)
+{
+ return smb_nscd_flush_cache("group");
+}