summaryrefslogtreecommitdiff
path: root/source3/winbindd/winbindd.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-05-30 17:52:54 -0700
committerJeremy Allison <jra@samba.org>2008-05-30 17:52:54 -0700
commit908812e98d84bd3eded612cd6f40637997a966ff (patch)
treeb57ba395225724b8ac27132083bf99b715e26475 /source3/winbindd/winbindd.c
parenta991c5a7c30253fa36e1ee65fb717d62acf3a806 (diff)
downloadsamba-908812e98d84bd3eded612cd6f40637997a966ff.tar.gz
samba-908812e98d84bd3eded612cd6f40637997a966ff.tar.bz2
samba-908812e98d84bd3eded612cd6f40637997a966ff.zip
Fix bug #5504. winbindd children and parent were handing SIGTERM in the same way - deleting the socket!
Jeremy. (This used to be commit 3ab5a3883e33eba159152aa02544d71f047c7e45)
Diffstat (limited to 'source3/winbindd/winbindd.c')
-rw-r--r--source3/winbindd/winbindd.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 57eee20f49..c017916f09 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -131,15 +131,20 @@ static void flush_caches(void)
/* Handle the signal by unlinking socket and exiting */
-static void terminate(void)
+static void terminate(bool is_parent)
{
- char *path = NULL;
-
- /* Remove socket file */
- if (asprintf(&path, "%s/%s",
+ if (is_parent) {
+ /* When parent goes away we should
+ * remove the socket file. Not so
+ * when children terminate.
+ */
+ char *path = NULL;
+
+ if (asprintf(&path, "%s/%s",
get_winbind_pipe_dir(), WINBINDD_SOCKET_NAME) > 0) {
- unlink(path);
- SAFE_FREE(path);
+ unlink(path);
+ SAFE_FREE(path);
+ }
}
idmap_close();
@@ -810,10 +815,10 @@ void winbind_check_sighup(void)
}
/* check if TERM has been received */
-void winbind_check_sigterm(void)
+void winbind_check_sigterm(bool is_parent)
{
if (do_sigterm)
- terminate();
+ terminate(is_parent);
}
/* Process incoming clients on listen_sock. We use a tricky non-blocking,
@@ -975,7 +980,7 @@ static void process_loop(void)
/* Check signal handling things */
- winbind_check_sigterm();
+ winbind_check_sigterm(true);
winbind_check_sighup();
if (do_sigusr2) {