From 107745477f7a77eb46376527eb9024e96e6586f0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnther=20Deschner?= Date: Thu, 16 Mar 2006 13:37:23 +0000 Subject: [PATCH] r14474: Also flush the nscd caches before entering the main winbindd loop. Guenther --- source/nsswitch/winbindd.c | 2 ++ source/nsswitch/winbindd_dual.c | 17 +---------------- source/nsswitch/winbindd_util.c | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/source/nsswitch/winbindd.c b/source/nsswitch/winbindd.c index 59437f05c2f..33ec9ded837 100644 --- a/source/nsswitch/winbindd.c +++ b/source/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/source/nsswitch/winbindd_dual.c b/source/nsswitch/winbindd_dual.c index fc889eb8a9f..f70b2539d37 100644 --- a/source/nsswitch/winbindd_dual.c +++ b/source/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/source/nsswitch/winbindd_util.c b/source/nsswitch/winbindd_util.c index 20f25a3954a..ae5f826a887 100644 --- a/source/nsswitch/winbindd_util.c +++ b/source/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 +} + -- 2.11.4.GIT