summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-03-16 13:37:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:15:33 -0500
commit962e42caa5d2b53b849a90d7c1c2bf0d45e26d4e (patch)
tree3b4423284b5051f8e3dafbb349d5fb7157cc3c03 /source3/nsswitch
parentef115ff3148b1590ca6128ec31975ef20e334f66 (diff)
downloadsamba-962e42caa5d2b53b849a90d7c1c2bf0d45e26d4e.tar.gz
samba-962e42caa5d2b53b849a90d7c1c2bf0d45e26d4e.tar.bz2
samba-962e42caa5d2b53b849a90d7c1c2bf0d45e26d4e.zip
r14474: Also flush the nscd caches before entering the main winbindd loop.
Guenther (This used to be commit c81eb71834dc827db63c8adb3f816bbbe916473c)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/winbindd.c2
-rw-r--r--source3/nsswitch/winbindd_dual.c17
-rw-r--r--source3/nsswitch/winbindd_util.c22
3 files changed, 25 insertions, 16 deletions
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c
index 59437f05c2..33ec9ded83 100644
--- a/source3/nsswitch/winbindd.c
+++ b/source3/nsswitch/winbindd.c
@@ -1078,6 +1078,8 @@ int main(int argc, char **argv)
init_idmap_child();
+ winbindd_flush_nscd_cache();
+
/* Loop waiting for requests */
while (1)
diff --git a/source3/nsswitch/winbindd_dual.c b/source3/nsswitch/winbindd_dual.c
index fc889eb8a9..f70b2539d3 100644
--- a/source3/nsswitch/winbindd_dual.c
+++ b/source3/nsswitch/winbindd_dual.c
@@ -570,22 +570,7 @@ static void child_msg_online(int msg_type, struct process_id src, void *buf, siz
/* Set our global state as online. */
set_global_winbindd_state_online();
-#ifdef HAVE_NSCD_FLUSH_CACHE
- {
- /* Flush nscd caches to get accurate new information */
- int ret = nscd_flush_cache("passwd");
- if (ret) {
- DEBUG(5,("failed to flush nscd cache for 'passwd' service: %s\n",
- strerror(ret)));
- }
-
- ret = nscd_flush_cache("group");
- if (ret) {
- DEBUG(5,("failed to flush nscd cache for 'group' service: %s\n",
- strerror(ret)));
- }
- }
-#endif
+ winbindd_flush_nscd_cache();
/* Mark everything online - delete any negative cache entries
to force an immediate reconnect. */
diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c
index 20f25a3954..ae5f826a88 100644
--- a/source3/nsswitch/winbindd_util.c
+++ b/source3/nsswitch/winbindd_util.c
@@ -1215,3 +1215,25 @@ BOOL winbindd_upgrade_idmap(void)
return idmap_convert(idmap_name);
}
+
+void winbindd_flush_nscd_cache(void)
+{
+#ifdef HAVE_NSCD_FLUSH_CACHE
+
+ /* Flush nscd caches to get accurate new information */
+ int ret = nscd_flush_cache("passwd");
+ if (ret) {
+ DEBUG(5,("failed to flush nscd cache for 'passwd' service: %s\n",
+ strerror(ret)));
+ }
+
+ ret = nscd_flush_cache("group");
+ if (ret) {
+ DEBUG(5,("failed to flush nscd cache for 'group' service: %s\n",
+ strerror(ret)));
+ }
+#else
+ return;
+#endif
+}
+