[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Dec 14 02:48:01 UTC 2022


The branch, master has been updated
       via  5955dc1e4fd smbd: set long process name of smbd child processes to "smbd: <CLIENT IP>"
       via  fc57b88e6a9 smbd: remove process shortname arg from reinit_after_fork()
       via  38ba7d1476c smbd: remove process shortname arg from smbd_reinit_after_fork()
       via  62cc0bbab0a smbd: explicitly call process_set_title()
       via  096295a6fe3 winbindd: Use process_set_title() instead of setproctitle()
       via  1b62dfa68d0 s4/samba: use process_set_title()
       via  969e062724f lib/util: use process_set_title() in tfork()
       via  14571c5cc47 smbd: prepare smbd for calling setproctitle()
       via  19c82c19c00 lib/util: add process_set_title()
      from  987cba90573 CVE-2022-37966 python:/tests/krb5: call sys.path.insert(0, "bin/python") before any other imports

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


- Log -----------------------------------------------------------------
commit 5955dc1e4fde7c1335cae5c7fd9bef71fd3fab3c
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 2 09:49:11 2022 +0100

    smbd: set long process name of smbd child processes to "smbd: <CLIENT IP>"
    
    The resulting process listings, depending on the format chosen for the process
    name, show the relevant smbd processes like this:
    
    $ ps faxo pid,uid,comm | egrep "\_.*smbd" | grep -v grep
    1690322     0  \_ smbd
    1690326     0      \_ smbd-notifyd
    1690327     0      \_ smbd-cleanupd
    1690337     0      \_ smbd[::1]
    
    $ ps faxo pid,uid,args | egrep "\_.*smbd" | grep -v grep
    1690322     0  \_ ./bin/smbd -D
    1690326     0      \_ smbd: notifyd
    1690327     0      \_ smbd: cleanupd
    1690337     0      \_ smbd: client [::1]
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Dec 14 02:47:24 UTC 2022 on sn-devel-184

commit fc57b88e6a93d59ad243364a513d33cecf66e4ab
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Dec 3 17:04:33 2022 +0100

    smbd: remove process shortname arg from reinit_after_fork()
    
    All callers pass NULL anyway, so it isn't used anymore.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 38ba7d1476c1bdb5bbde70c45b47d12ab1699516
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Dec 3 16:59:39 2022 +0100

    smbd: remove process shortname arg from smbd_reinit_after_fork()
    
    All callers already do this explicitly by calling process_set_title().
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 62cc0bbab0a5146f7fdc8b3865b662b0f55f89d2
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Dec 3 16:56:20 2022 +0100

    smbd: explicitly call process_set_title()
    
    Currently setting the shortname is achieved via the final arg to
    smbd_reinit_after_fork(), but I'm going to remove that arg soon.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 096295a6fe348937a8f23b5064f14896b59e35e6
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 1 18:18:29 2022 +0100

    winbindd: Use process_set_title() instead of setproctitle()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 1b62dfa68d07a2cdec76b635e82fd9b099a43c41
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 2 15:39:25 2022 +0100

    s4/samba: use process_set_title()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 969e062724f39d7406fddfd335533f8c24cb641d
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 2 15:38:44 2022 +0100

    lib/util: use process_set_title() in tfork()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 14571c5cc47ccc1d168f38c65d786b61492485d9
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 2 15:36:39 2022 +0100

    smbd: prepare smbd for calling setproctitle()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 19c82c19c009eefe975ae95c8b709fc93f5f4c39
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 2 15:17:20 2022 +0100

    lib/util: add process_set_title()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 lib/util/tfork.c                 |  7 +++----
 lib/util/util_process.c          | 32 +++++++++++++++++++++++++++++---
 lib/util/util_process.h          | 13 +++++++++++++
 source3/include/proto.h          |  6 ++----
 source3/lib/background.c         |  2 +-
 source3/lib/util.c               |  7 +------
 source3/nmbd/asyncdns.c          |  2 +-
 source3/nmbd/nmbd.c              |  2 +-
 source3/printing/print_cups.c    |  2 +-
 source3/rpc_server/rpc_host.c    |  2 +-
 source3/smbd/scavenger.c         |  3 ++-
 source3/smbd/server.c            | 21 ++++++++++++++++-----
 source3/smbd/server_exit.c       |  4 ++--
 source3/smbd/smb1_process.c      |  5 +++--
 source3/torture/test_g_lock.c    |  6 +++---
 source3/winbindd/winbindd.c      |  5 +++--
 source3/winbindd/winbindd_dual.c |  7 ++++---
 source4/samba/process_prefork.c  | 20 ++++++--------------
 source4/samba/process_standard.c | 14 ++------------
 19 files changed, 94 insertions(+), 66 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/tfork.c b/lib/util/tfork.c
index d64c7174fbf..9867543702e 100644
--- a/lib/util/tfork.c
+++ b/lib/util/tfork.c
@@ -572,8 +572,8 @@ static pid_t tfork_start_waiter_and_worker(struct tfork_state *state,
 	/*
 	 * The "waiter" child.
 	 */
-	setproctitle("tfork waiter process");
-	prctl_set_comment("tfork waiter");
+	process_set_title("tfork waiter", "tfork waiter proces");
+
 	CatchSignal(SIGCHLD, SIG_DFL);
 
 	close(status_sp_caller_fd);
@@ -605,8 +605,7 @@ static pid_t tfork_start_waiter_and_worker(struct tfork_state *state,
 		return 0;
 	}
 	state->worker_pid = pid;
-	setproctitle("tfork waiter process(%d)", pid);
-	prctl_set_comment("tfork(%d)", pid);
+	process_set_title("tfork(%d)", "tfork waiter process(%d)", pid);
 
 	close(ready_pipe_worker_fd);
 
diff --git a/lib/util/util_process.c b/lib/util/util_process.c
index bb5dc15fa98..4b13c591309 100644
--- a/lib/util/util_process.c
+++ b/lib/util/util_process.c
@@ -26,16 +26,42 @@
 #include <sys/prctl.h>
 #endif
 
-int prctl_set_comment(const char *comment_format, ...)
+void process_set_title(const char *short_format, const char *long_format, ...)
 {
 #if defined(HAVE_PRCTL) && defined(PR_SET_NAME)
+	if (short_format != NULL) {
+		char short_comment[16] = {0,};
+		va_list ap;
+
+		va_start(ap, long_format);
+		vsnprintf(short_comment, sizeof(short_comment), short_format, ap);
+		va_end(ap);
+
+		prctl(PR_SET_NAME, (unsigned long) short_comment, 0, 0, 0);
+	}
+#endif
+
+	if (long_format != NULL) {
+		char long_comment[256] = {0,};
+		va_list ap;
+
+		va_start(ap, long_format);
+		vsnprintf(long_comment, sizeof(long_comment), long_format, ap);
+		va_end(ap);
+
+		setproctitle("%s", long_comment);
+	}
+}
+
+int prctl_set_comment(const char *comment_format, ...)
+{
 	char comment[16];
 	va_list ap;
+
 	va_start(ap, comment_format);
 	vsnprintf(comment, sizeof(comment), comment_format, ap);
 	va_end(ap);
 
-	return prctl(PR_SET_NAME, (unsigned long) comment, 0, 0, 0);
-#endif
+	process_set_title("%s", "%s", comment);
 	return 0;
 }
diff --git a/lib/util/util_process.h b/lib/util/util_process.h
index 5b337d32aec..ccb2a752232 100644
--- a/lib/util/util_process.h
+++ b/lib/util/util_process.h
@@ -34,4 +34,17 @@
  */
 int prctl_set_comment(const char *comment_format, ...) PRINTF_ATTRIBUTE(1,2);
 
+/**
+ * @brief Set the process comment name and longname
+ *
+ * @param[in]  short_format    The comment to set which shouldn't be longer than 16
+ *                             16 characters (including \0).
+ * @param[in]  long_format     The format string and arguments to produce the long
+ *                             form of the process name.
+ *
+ * @return              -1 on error, 0 on success.
+ */
+void process_set_title(const char *short_format, const char *long_format, ...)
+	PRINTF_ATTRIBUTE(1,3) PRINTF_ATTRIBUTE(2,3);
+
 #endif
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 3d3cd93d5bc..bbd45c536ff 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -301,12 +301,10 @@ NTSTATUS init_before_fork(void);
 int parent_watch_fd(void);
 NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
 			   struct tevent_context *ev_ctx,
-			   bool parent_longlived,
-			   const char *comment);
+			   bool parent_longlived);
 NTSTATUS smbd_reinit_after_fork(struct messaging_context *msg_ctx,
 				struct tevent_context *ev_ctx,
-				bool parent_longlived,
-				const char *comment);
+				bool parent_longlived);
 void *malloc_(size_t size);
 void *Realloc(void *p, size_t size, bool free_old_on_error);
 void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size,
diff --git a/source3/lib/background.c b/source3/lib/background.c
index 74f7496d4f6..cf6cc3abaa0 100644
--- a/source3/lib/background.c
+++ b/source3/lib/background.c
@@ -176,7 +176,7 @@ static void background_job_waited(struct tevent_req *subreq)
 
 		close(fds[0]);
 
-		status = reinit_after_fork(state->msg, state->ev, true, NULL);
+		status = reinit_after_fork(state->msg, state->ev, true);
 		if (NT_STATUS_IS_OK(status)) {
 			res = state->fn(state->private_data);
 		} else {
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 912ce1d3004..eef76662f45 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -429,8 +429,7 @@ static void reinit_after_fork_pipe_handler(struct tevent_context *ev,
 
 NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
 			   struct tevent_context *ev_ctx,
-			   bool parent_longlived,
-			   const char *comment)
+			   bool parent_longlived)
 {
 	NTSTATUS status = NT_STATUS_OK;
 	int ret;
@@ -503,10 +502,6 @@ NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
 		}
 	}
 
-	if (comment) {
-		prctl_set_comment("%s", comment);
-	}
-
  done:
 	return status;
 }
diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c
index e52380b03f0..2d4a9cd8446 100644
--- a/source3/nmbd/asyncdns.c
+++ b/source3/nmbd/asyncdns.c
@@ -167,7 +167,7 @@ void start_async_dns(struct messaging_context *msg)
 	CatchSignal(SIGHUP, SIG_IGN);
         CatchSignal(SIGTERM, sig_term);
 
-	status = reinit_after_fork(msg, nmbd_event_context(), true, NULL);
+	status = reinit_after_fork(msg, nmbd_event_context(), true);
 
 	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(0,("reinit_after_fork() failed\n"));
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 7470897587e..e5794cc13bd 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -983,7 +983,7 @@ static bool open_sockets(bool isdaemon, int port)
 
 	pidfile_create(lp_pid_directory(), "nmbd");
 
-	status = reinit_after_fork(msg, nmbd_event_context(), false, NULL);
+	status = reinit_after_fork(msg, nmbd_event_context(), false);
 
 	if (!NT_STATUS_IS_OK(status)) {
 		exit_daemon("reinit_after_fork() failed", map_errno_from_nt_status(status));
diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c
index 0bbd7c8eff3..4d83d398675 100644
--- a/source3/printing/print_cups.c
+++ b/source3/printing/print_cups.c
@@ -495,7 +495,7 @@ static bool cups_pcap_load_async(struct tevent_context *ev,
 
 	close_all_print_db();
 
-	status = reinit_after_fork(msg_ctx, ev, true, NULL);
+	status = reinit_after_fork(msg_ctx, ev, true);
 	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(0,("cups_pcap_load_async: reinit_after_fork() failed\n"));
 		smb_panic("cups_pcap_load_async: reinit_after_fork() failed");
diff --git a/source3/rpc_server/rpc_host.c b/source3/rpc_server/rpc_host.c
index 7ca24240a92..f58c825e7cc 100644
--- a/source3/rpc_server/rpc_host.c
+++ b/source3/rpc_server/rpc_host.c
@@ -2949,7 +2949,7 @@ int main(int argc, const char *argv[])
 			cmdline_daemon_cfg->no_process_group,
 			log_stdout);
 
-		status = reinit_after_fork(msg_ctx, ev_ctx, false, NULL);
+		status = reinit_after_fork(msg_ctx, ev_ctx, false);
 		if (!NT_STATUS_IS_OK(status)) {
 			exit_daemon("reinit_after_fork() failed",
 				    map_errno_from_nt_status(status));
diff --git a/source3/smbd/scavenger.c b/source3/smbd/scavenger.c
index fe47c22e05f..897ddf1617c 100644
--- a/source3/smbd/scavenger.c
+++ b/source3/smbd/scavenger.c
@@ -246,7 +246,7 @@ static bool smbd_scavenger_start(struct smbd_scavenger_state *state)
 		close(fds[0]);
 
 		status = smbd_reinit_after_fork(state->msg, state->ev,
-						true, "smbd-scavenger");
+						true);
 		if (!NT_STATUS_IS_OK(status)) {
 			DEBUG(2, ("reinit_after_fork failed: %s\n",
 				  nt_errstr(status)));
@@ -254,6 +254,7 @@ static bool smbd_scavenger_start(struct smbd_scavenger_state *state)
 			return false;
 		}
 
+		process_set_title("smbd-scavenger", "scavenger");
 		reopen_logs();
 
 		state->am_scavenger = true;
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 9b211238c11..155d2207609 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -35,6 +35,7 @@
 #include "secrets.h"
 #include "../lib/util/memcache.h"
 #include "ctdbd_conn.h"
+#include "lib/util/util_process.h"
 #include "util_cluster.h"
 #include "printing/queue_process.h"
 #include "rpc_server/rpc_config.h"
@@ -428,13 +429,15 @@ static bool smbd_notifyd_init(struct messaging_context *msg, bool interactive,
 		return true;
 	}
 
-	status = smbd_reinit_after_fork(msg, ev, true, "smbd-notifyd");
+	status = smbd_reinit_after_fork(msg, ev, true);
 	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(1, ("%s: reinit_after_fork failed: %s\n",
 			  __func__, nt_errstr(status)));
 		exit(1);
 	}
 
+	process_set_title("smbd-notifyd", "notifyd");
+
 	reopen_logs();
 
 	/* Set up sighup handler for notifyd */
@@ -642,7 +645,7 @@ static bool cleanupd_init(struct messaging_context *msg, bool interactive,
 
 	close(up_pipe[0]);
 
-	status = smbd_reinit_after_fork(msg, ev, true, "cleanupd");
+	status = smbd_reinit_after_fork(msg, ev, true);
 	if (!NT_STATUS_IS_OK(status)) {
 		DBG_WARNING("reinit_after_fork failed: %s\n",
 			    nt_errstr(status));
@@ -652,6 +655,8 @@ static bool cleanupd_init(struct messaging_context *msg, bool interactive,
 		exit(1);
 	}
 
+	process_set_title("smbd-cleanupd", "cleanupd");
+
 	se = tevent_add_signal(ev,
 			       ev,
 			       SIGHUP,
@@ -984,7 +989,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
 	smb_set_close_on_exec(fd);
 
 	if (s->parent->interactive) {
-		reinit_after_fork(msg_ctx, ev, true, NULL);
+		reinit_after_fork(msg_ctx, ev, true);
 		smbd_process(ev, msg_ctx, fd, true);
 		exit_server_cleanly("end of interactive mode");
 		return;
@@ -997,6 +1002,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
 
 	pid = fork();
 	if (pid == 0) {
+		char addrstr[INET6_ADDRSTRLEN];
 		NTSTATUS status = NT_STATUS_OK;
 
 		/*
@@ -1010,7 +1016,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
 		 * them, counting worker smbds. */
 		CatchChild();
 
-		status = smbd_reinit_after_fork(msg_ctx, ev, true, NULL);
+		status = smbd_reinit_after_fork(msg_ctx, ev, true);
 		if (!NT_STATUS_IS_OK(status)) {
 			if (NT_STATUS_EQUAL(status,
 					    NT_STATUS_TOO_MANY_OPENED_FILES)) {
@@ -1034,6 +1040,9 @@ static void smbd_accept_connection(struct tevent_context *ev,
 			smb_panic("reinit_after_fork() failed");
 		}
 
+		print_sockaddr(addrstr, sizeof(addrstr), &addr);
+		process_set_title("smbd[%s]", "client [%s]", addrstr);
+
 		smbd_process(ev, msg_ctx, fd, false);
 	 exit:
 		exit_server_cleanly("end of child");
@@ -1627,6 +1636,8 @@ extern void build_options(bool screen);
 	};
 	bool ok;
 
+	setproctitle_init(argc, discard_const(argv), environ);
+
 	/*
 	 * Do this before any other talloc operation
 	 */
@@ -1878,7 +1889,7 @@ extern void build_options(bool screen);
 	if (cmdline_daemon_cfg->daemon)
 		pidfile_create(lp_pid_directory(), "smbd");
 
-	status = reinit_after_fork(msg_ctx, ev_ctx, false, NULL);
+	status = reinit_after_fork(msg_ctx, ev_ctx, false);
 	if (!NT_STATUS_IS_OK(status)) {
 		exit_daemon("reinit_after_fork() failed", map_errno_from_nt_status(status));
 	}
diff --git a/source3/smbd/server_exit.c b/source3/smbd/server_exit.c
index b4a84e1a3f3..5e0c386e090 100644
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -252,11 +252,11 @@ void smbd_exit_server_cleanly(const char *const explanation)
  */
 NTSTATUS smbd_reinit_after_fork(struct messaging_context *msg_ctx,
 				struct tevent_context *ev_ctx,
-				bool parent_longlived, const char *comment)
+				bool parent_longlived)
 {
 	NTSTATUS ret;
 	am_parent = NULL;
-	ret = reinit_after_fork(msg_ctx, ev_ctx, parent_longlived, comment);
+	ret = reinit_after_fork(msg_ctx, ev_ctx, parent_longlived);
 	initialize_password_db(true, ev_ctx);
 	return ret;
 }
diff --git a/source3/smbd/smb1_process.c b/source3/smbd/smb1_process.c
index 140884adb96..9edfa2116e9 100644
--- a/source3/smbd/smb1_process.c
+++ b/source3/smbd/smb1_process.c
@@ -47,6 +47,7 @@
 #include "libcli/smb/smbXcli_base.h"
 #include "lib/util/time_basic.h"
 #include "source3/lib/substitute.h"
+#include "lib/util/util_process.h"
 
 /* Internal message queue for deferred opens. */
 struct pending_message_list {
@@ -2605,13 +2606,13 @@ bool fork_echo_handler(struct smbXsrv_connection *xconn)
 
 		status = smbd_reinit_after_fork(xconn->client->msg_ctx,
 						xconn->client->raw_ev_ctx,
-						true,
-						"smbd-echo");
+						true);
 		if (!NT_STATUS_IS_OK(status)) {
 			DEBUG(1, ("reinit_after_fork failed: %s\n",
 				  nt_errstr(status)));
 			exit(1);
 		}
+		process_set_title("smbd-echo", "echo handler");
 		initialize_password_db(true, xconn->client->raw_ev_ctx);
 		smbd_echo_loop(xconn, listener_pipe[1]);
 		exit(0);
diff --git a/source3/torture/test_g_lock.c b/source3/torture/test_g_lock.c
index ad3793633f3..fee91270323 100644
--- a/source3/torture/test_g_lock.c
+++ b/source3/torture/test_g_lock.c
@@ -776,7 +776,7 @@ bool run_g_lock5(int dummy)
 		if (child == 0) {
 			TALLOC_FREE(ctx);
 
-			status = reinit_after_fork(msg, ev, false, "");
+			status = reinit_after_fork(msg, ev, false);
 
 			close(ready_pipe[0]);
 			close(exit_pipe[1]);
@@ -943,7 +943,7 @@ bool run_g_lock6(int dummy)
 		if (child == 0) {
 			TALLOC_FREE(ctx);
 
-			status = reinit_after_fork(msg, ev, false, "");
+			status = reinit_after_fork(msg, ev, false);
 			if (!NT_STATUS_IS_OK(status)) {
 				fprintf(stderr, "reinit_after_fork failed: %s\n",
 					nt_errstr(status));
@@ -1106,7 +1106,7 @@ bool run_g_lock7(int dummy)
 		close(down_pipe[1]);
 		down_pipe[1] = -1;
 
-		status = reinit_after_fork(msg, ev, false, "");
+		status = reinit_after_fork(msg, ev, false);
 		if (!NT_STATUS_IS_OK(status)) {
 			fprintf(stderr,
 				"reinit_after_fork failed: %s\n",
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 6796b07bca3..50dc6d6bd92 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -53,6 +53,7 @@
 #include "lib/global_contexts.h"
 #include "source3/lib/substitute.h"
 #include "winbindd_traceid.h"
+#include "lib/util/util_process.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
@@ -257,7 +258,7 @@ static void winbind_msg_validate_cache(struct messaging_context *msg_ctx,
 	/* install default SIGCHLD handler: validation code uses fork/waitpid */
 	CatchSignal(SIGCHLD, SIG_DFL);
 
-	setproctitle("validate cache child");
+	process_set_title("wb: check cache", "validate cache child");
 
 	ret = (uint8_t)winbindd_validate_cache_nobackup();
 	DEBUG(10, ("winbindd_msg_validata_cache: got return value %d\n", ret));
@@ -1628,7 +1629,7 @@ int main(int argc, const char **argv)
 
 	status = reinit_after_fork(global_messaging_context(),
 				   global_event_context(),
-				   false, NULL);
+				   false);
 	if (!NT_STATUS_IS_OK(status)) {
 		exit_daemon("Winbindd reinit_after_fork() failed", map_errno_from_nt_status(status));
 	}
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index fe855045fa8..8cb59b2f752 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -48,6 +48,7 @@
 #include "libcli/auth/netlogon_creds_cli.h"
 #include "../lib/util/pidfile.h"
 #include "librpc/gen_ndr/ndr_winbind_c.h"
+#include "lib/util/util_process.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
@@ -1529,7 +1530,7 @@ NTSTATUS winbindd_reinit_after_fork(const struct winbindd_child *myself,
 	status = reinit_after_fork(
 		global_messaging_context(),
 		global_event_context(),
-		true, NULL);
+		true);
 	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(0,("reinit_after_fork() failed\n"));
 		return status;
@@ -1762,9 +1763,9 @@ static bool fork_domain_child(struct winbindd_child *child)
 	}
 
 	if (child_domain != NULL) {
-		setproctitle("domain child [%s]", child_domain->name);
+		process_set_title("wb[%s]", "domain child [%s]", child_domain->name);
 	} else if (is_idmap_child(child)) {
-		setproctitle("idmap child");
+		process_set_title("wb-idmap", "idmap child");
 	}
 
 	/* Handle online/offline messages. */
diff --git a/source4/samba/process_prefork.c b/source4/samba/process_prefork.c
index f2927efbb06..35145c7403d 100644
--- a/source4/samba/process_prefork.c
+++ b/source4/samba/process_prefork.c
@@ -293,12 +293,8 @@ static void prefork_fork_master(
 	}
 
 	pid = getpid();
-	setproctitle("task[%s] pre-fork master", service_name);
-	/*
-	 * We must fit within 15 chars of text or we will truncate, so
-	 * we put the constant part last
-	 */
-	prctl_set_comment("%s[master]", service_name);
+
+	process_set_title("%s[master]", "task[%s] pre-fork master", service_name);
 
 	/*
 	 * this will free all the listening sockets and all state that
@@ -753,16 +749,12 @@ static void prefork_fork_worker(struct task_server *task,
 		free(w);
 
 		TALLOC_FREE(ev);
-		setproctitle("task[%s] pre-forked worker(%d)",
-			     service_name,
-			     pd->instances);
-		/*
-		 * We must fit within 15 chars of text or we will truncate, so
-		 * we put child number last
-		 */
-		prctl_set_comment("%s(%d)",
+


-- 
Samba Shared Repository



More information about the samba-cvs mailing list