[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-2494-gfb3e5a1

Jeremy Allison jra at samba.org
Sat May 31 00:50:46 GMT 2008


The branch, v3-2-test has been updated
       via  fb3e5a14dabeb36b55c31ab3b6c502de1e0d1fe0 (commit)
      from  d5ee3b19ebc7b19d7e02f3fb849dcec20fca476f (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit fb3e5a14dabeb36b55c31ab3b6c502de1e0d1fe0
Author: Jeremy Allison <jra at samba.org>
Date:   Fri May 30 17:49:33 2008 -0700

    Fix bug #5504. winbindd children and parent were handing SIGTERM in the same way - deleting the socket!
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source/winbindd/winbindd.c      |   25 +++++++++++++++----------
 source/winbindd/winbindd_dual.c |    2 +-
 2 files changed, 16 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/winbindd/winbindd.c b/source/winbindd/winbindd.c
index 57eee20..c017916 100644
--- a/source/winbindd/winbindd.c
+++ b/source/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) {
diff --git a/source/winbindd/winbindd_dual.c b/source/winbindd/winbindd_dual.c
index ae04256..b8c0ab9 100644
--- a/source/winbindd/winbindd_dual.c
+++ b/source/winbindd/winbindd_dual.c
@@ -1097,7 +1097,7 @@ static bool fork_domain_child(struct winbindd_child *child)
 		TALLOC_CTX *frame = talloc_stackframe();
 
 		/* check for signals */
-		winbind_check_sigterm();
+		winbind_check_sigterm(false);
 		winbind_check_sighup();
 
 		run_events(winbind_event_context(), 0, NULL, NULL);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list