[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Mon Sep 18 02:40:02 UTC 2017


The branch, master has been updated
       via  af38d73 s4/smbd: set the process group.
      from  c8e325c winbindd: Remove an obsolete comment

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit af38d73b06c0c40ef59c2ffe0fc6580b0787b7d0
Author: Gary Lockyer <gary at catalyst.net.nz>
Date:   Mon Aug 21 15:12:04 2017 +1200

    s4/smbd: set the process group.
    
    Set the process group in the samba daemon, the --no-process-group option
    allows this to be disabled.  The no-process-group option needs to be
    disabled in self test.
    
    Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Mon Sep 18 04:39:50 CEST 2017 on sn-devel-144

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

Summary of changes:
 selftest/target/Samba4.pm |  2 +-
 source4/smbd/server.c     | 18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index f0f7042..3d14885 100755
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -158,7 +158,7 @@ sub check_or_start($$$)
 		close($env_vars->{STDIN_PIPE});
 		open STDIN, ">&", $STDIN_READER or die "can't dup STDIN_READER to STDIN: $!";
 
-		exec(@preargs, Samba::bindir_path($self, "samba"), "-M", $process_model, "-i", "--maximum-runtime=$self->{server_maxtime}", $env_vars->{CONFIGURATION}, @optargs) or die("Unable to start samba: $!");
+		exec(@preargs, Samba::bindir_path($self, "samba"), "-M", $process_model, "-i", "--no-process-group", "--maximum-runtime=$self->{server_maxtime}", $env_vars->{CONFIGURATION}, @optargs) or die("Unable to start samba: $!");
 	}
 	$env_vars->{SAMBA_PID} = $pid;
 	print "DONE ($pid)\n";
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index a8bad06..ba520e0 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -341,6 +341,7 @@ static int binary_smbd_main(const char *binary_name,
 {
 	bool opt_daemon = false;
 	bool opt_interactive = false;
+	bool opt_no_process_group = false;
 	int opt;
 	poptContext pc;
 #define _MODULE_PROTO(init) extern NTSTATUS init(TALLOC_CTX *);
@@ -356,7 +357,8 @@ static int binary_smbd_main(const char *binary_name,
 		OPT_DAEMON = 1000,
 		OPT_INTERACTIVE,
 		OPT_PROCESS_MODEL,
-		OPT_SHOW_BUILD
+		OPT_SHOW_BUILD,
+		OPT_NO_PROCESS_GROUP,
 	};
 	struct poptOption long_options[] = {
 		POPT_AUTOHELP
@@ -371,6 +373,8 @@ static int binary_smbd_main(const char *binary_name,
 			"till autotermination", "seconds"},
 		{"show-build", 'b', POPT_ARG_NONE, NULL, OPT_SHOW_BUILD,
 			"show build info", NULL },
+		{"no-process-group", '\0', POPT_ARG_NONE, NULL,
+		  OPT_NO_PROCESS_GROUP, "Don't create a new process group" },
 		POPT_COMMON_SAMBA
 		POPT_COMMON_VERSION
 		{ NULL }
@@ -393,6 +397,9 @@ static int binary_smbd_main(const char *binary_name,
 		case OPT_SHOW_BUILD:
 			show_build();
 			break;
+		case OPT_NO_PROCESS_GROUP:
+			opt_no_process_group = true;
+			break;
 		default:
 			fprintf(stderr, "\nInvalid option %s: %s\n\n",
 				  poptBadOption(pc, 0), poptStrerror(opt));
@@ -508,6 +515,15 @@ static int binary_smbd_main(const char *binary_name,
 		stdin_event_flags = 0;
 	}
 
+#if HAVE_SETPGID
+	/*
+	 * If we're interactive we want to set our own process group for
+	 * signal management, unless --no-process-group specified.
+	 */
+	if (opt_interactive && !opt_no_process_group)
+		setpgid((pid_t)0, (pid_t)0);
+#endif
+
 	/* catch EOF on stdin */
 #ifdef SIGTTIN
 	signal(SIGTTIN, SIG_IGN);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list