The Samba-Bugzilla – Attachment 14807 Details for
Bug 13752
smbcontrol <pid> debug/debuglevel/shutdown don't work with 'samba' processes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patches for v4-8-test
tmp48.diff.txt (text/plain), 9.46 KB, created by
Stefan Metzmacher
on 2019-01-30 10:19:34 UTC
(
hide
)
Description:
Patches for v4-8-test
Filename:
MIME Type:
Creator:
Stefan Metzmacher
Created:
2019-01-30 10:19:34 UTC
Size:
9.46 KB
patch
obsolete
>From d6c3f54850780bf4714eed8a38d032b5c1b5d2dc Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Thu, 17 Jan 2019 16:29:37 +0100 >Subject: [PATCH 1/5] manpages/samba.7.xml: smbcontrol can also work with > 'samba' >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Björn Baumbach <bbaumbach@samba.org> >(cherry picked from commit 12b9adec3ff48f4356f9ff865891dc3c652ff86b) >--- > docs-xml/manpages/samba.7.xml | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/docs-xml/manpages/samba.7.xml b/docs-xml/manpages/samba.7.xml >index 761c8d3c65ac..750a718185b1 100644 >--- a/docs-xml/manpages/samba.7.xml >+++ b/docs-xml/manpages/samba.7.xml >@@ -166,7 +166,7 @@ > <manvolnum>1</manvolnum></citerefentry></term> > <listitem><para><command>smbcontrol</command> is a utility > that can change the behaviour of running >- <command>smbd</command>, <command>nmbd</command> and >+ <command>samba</command>, <command>smbd</command>, <command>nmbd</command> and > <command>winbindd</command> daemons. > </para></listitem> > </varlistentry> >-- >2.17.1 > > >From 50905df51b2ec434a2a74b7df32c4e4131693c25 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Tue, 15 Jan 2019 01:39:06 +0100 >Subject: [PATCH 2/5] s4:messaging: add support 'smbcontrol <pid> > debug/debuglevel' >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Björn Baumbach <bbaumbach@samba.org> >(cherry picked from commit 3a0c1da432c53de234b54bac90a3fb84534994eb) >--- > source4/lib/messaging/messaging.c | 72 +++++++++++++++++++++++++++++++ > 1 file changed, 72 insertions(+) > >diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c >index b8d4e50f12c7..85be5baf258a 100644 >--- a/source4/lib/messaging/messaging.c >+++ b/source4/lib/messaging/messaging.c >@@ -121,6 +121,68 @@ static void ringbuf_log_msg(struct imessaging_context *msg, > imessaging_send(msg, src, MSG_RINGBUF_LOG, &blob); > } > >+/**************************************************************************** >+ Receive a "set debug level" message. >+****************************************************************************/ >+ >+static void debug_imessage(struct imessaging_context *msg_ctx, >+ void *private_data, >+ uint32_t msg_type, >+ struct server_id src, >+ DATA_BLOB *data) >+{ >+ const char *params_str = (const char *)data->data; >+ struct server_id_buf src_buf; >+ struct server_id dst = imessaging_get_server_id(msg_ctx); >+ struct server_id_buf dst_buf; >+ >+ /* Check, it's a proper string! */ >+ if (params_str[(data->length)-1] != '\0') { >+ DBG_ERR("Invalid debug message from pid %s to pid %s\n", >+ server_id_str_buf(src, &src_buf), >+ server_id_str_buf(dst, &dst_buf)); >+ return; >+ } >+ >+ DBG_ERR("INFO: Remote set of debug to `%s' (pid %s from pid %s)\n", >+ params_str, >+ server_id_str_buf(dst, &dst_buf), >+ server_id_str_buf(src, &src_buf)); >+ >+ debug_parse_levels(params_str); >+} >+ >+/**************************************************************************** >+ Return current debug level. >+****************************************************************************/ >+ >+static void debuglevel_imessage(struct imessaging_context *msg_ctx, >+ void *private_data, >+ uint32_t msg_type, >+ struct server_id src, >+ DATA_BLOB *data) >+{ >+ char *message = debug_list_class_names_and_levels(); >+ DATA_BLOB blob = data_blob_null; >+ struct server_id_buf src_buf; >+ struct server_id dst = imessaging_get_server_id(msg_ctx); >+ struct server_id_buf dst_buf; >+ >+ DBG_DEBUG("Received REQ_DEBUGLEVEL message (pid %s from pid %s)\n", >+ server_id_str_buf(dst, &dst_buf), >+ server_id_str_buf(src, &src_buf)); >+ >+ if (message == NULL) { >+ DBG_ERR("debug_list_class_names_and_levels returned NULL\n"); >+ return; >+ } >+ >+ blob = data_blob_string_const_null(message); >+ imessaging_send(msg_ctx, src, MSG_DEBUGLEVEL, &blob); >+ >+ TALLOC_FREE(message); >+} >+ > /* > return uptime of messaging server via irpc > */ >@@ -418,6 +480,16 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx, > if (!NT_STATUS_IS_OK(status)) { > goto fail; > } >+ status = imessaging_register(msg, NULL, MSG_DEBUG, >+ debug_imessage); >+ if (!NT_STATUS_IS_OK(status)) { >+ goto fail; >+ } >+ status = imessaging_register(msg, NULL, MSG_REQ_DEBUGLEVEL, >+ debuglevel_imessage); >+ if (!NT_STATUS_IS_OK(status)) { >+ goto fail; >+ } > status = IRPC_REGISTER(msg, irpc, IRPC_UPTIME, irpc_uptime, msg); > if (!NT_STATUS_IS_OK(status)) { > goto fail; >-- >2.17.1 > > >From 5e4f9cb01ad5ac687d41b280ef1faf3e78b91f0e Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Mon, 28 Jan 2019 16:29:51 +0100 >Subject: [PATCH 3/5] s4:server: avoid using pid=0 for the parent 'samba' > process >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >It confuses the 'samba-tool processes' output and log messages. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Björn Baumbach <bbaumbach@samba.org> >(cherry picked from commit 5bd7a8e5685caa09067745b108ef7e53e3108e97) >--- > source4/smbd/server.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/source4/smbd/server.c b/source4/smbd/server.c >index 431fbad31390..274a45d600cb 100644 >--- a/source4/smbd/server.c >+++ b/source4/smbd/server.c >@@ -274,7 +274,7 @@ static NTSTATUS setup_parent_messaging(struct server_state *state, > > msg = imessaging_init(state->event_ctx, > lp_ctx, >- cluster_id(0, SAMBA_PARENT_TASKID), >+ cluster_id(getpid(), SAMBA_PARENT_TASKID), > state->event_ctx); > NT_STATUS_HAVE_NO_MEMORY(msg); > >-- >2.17.1 > > >From 9b5c9ff48fd16bde827102b301eb5918c9b3d2e2 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Thu, 17 Jan 2019 16:27:10 +0100 >Subject: [PATCH 4/5] s4:server: add support for 'smbcontrol samba shutdown' >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Björn Baumbach <bbaumbach@samba.org> >(cherry picked from commit 832776c0fcf7cc658c128765514755c2d15b06a6) >--- > source4/smbd/server.c | 38 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 37 insertions(+), 1 deletion(-) > >diff --git a/source4/smbd/server.c b/source4/smbd/server.c >index 274a45d600cb..05d62c9a03ca 100644 >--- a/source4/smbd/server.c >+++ b/source4/smbd/server.c >@@ -44,6 +44,8 @@ > #include "nsswitch/winbind_client.h" > #include "libds/common/roles.h" > #include "lib/util/tfork.h" >+#include "dsdb/samdb/ldb_modules/util.h" >+#include "lib/util/server_id.h" > > #ifdef HAVE_PTHREAD > #include <pthread.h> >@@ -249,6 +251,31 @@ static void prime_ldb_databases(struct tevent_context *event_ctx) > } > > >+/* >+ called from 'smbcontrol samba shutdown' >+ */ >+static void samba_parent_shutdown(struct imessaging_context *msg, >+ void *private_data, >+ uint32_t msg_type, >+ struct server_id src, >+ DATA_BLOB *data) >+{ >+ struct server_state *state = >+ talloc_get_type_abort(private_data, >+ struct server_state); >+ struct server_id_buf src_buf; >+ struct server_id dst = imessaging_get_server_id(msg); >+ struct server_id_buf dst_buf; >+ >+ DBG_ERR("samba_shutdown of %s %s: from %s\n", >+ state->binary_name, >+ server_id_str_buf(dst, &dst_buf), >+ server_id_str_buf(src, &src_buf)); >+ >+ TALLOC_FREE(state); >+ exit(0); >+} >+ > /* > called when a fatal condition occurs in a child task > */ >@@ -283,10 +310,19 @@ static NTSTATUS setup_parent_messaging(struct server_state *state, > return status; > } > >+ status = imessaging_register(msg, state, MSG_SHUTDOWN, >+ samba_parent_shutdown); >+ if (!NT_STATUS_IS_OK(status)) { >+ return status; >+ } >+ > status = IRPC_REGISTER(msg, irpc, SAMBA_TERMINATE, > samba_terminate, state); >+ if (!NT_STATUS_IS_OK(status)) { >+ return status; >+ } > >- return status; >+ return NT_STATUS_OK; > } > > >-- >2.17.1 > > >From 15cd4dcdce2c27736b8a927196e779cd15aa402e Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Thu, 17 Jan 2019 23:50:45 +0100 >Subject: [PATCH 5/5] selftest:Samba4: use 'smbcontrol samba shutdown' >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Björn Baumbach <bbaumbach@samba.org> > >Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> >Autobuild-Date(master): Wed Jan 30 01:51:48 CET 2019 on sn-devel-144 > >(cherry picked from commit d03991f569b54ae0a11911b622107fbae701715d) >--- > selftest/target/Samba4.pm | 9 +++++++++ > 1 file changed, 9 insertions(+) > >diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm >index d6d67f5a5ab5..264eaf350071 100755 >--- a/selftest/target/Samba4.pm >+++ b/selftest/target/Samba4.pm >@@ -1982,6 +1982,15 @@ sub teardown_env_terminate($$) > my ($self, $envvars) = @_; > my $pid; > >+ # This should cause samba to terminate gracefully >+ my $smbcontrol = Samba::bindir_path($self, "smbcontrol"); >+ my $cmd = ""; >+ $cmd .= "$smbcontrol samba shutdown $envvars->{CONFIGURATION}"; >+ my $ret = system($cmd); >+ if ($ret != 0) { >+ warn "'$cmd' failed with '$ret'\n"; >+ } >+ > # This should cause samba to terminate gracefully > close($envvars->{STDIN_PIPE}); > >-- >2.17.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
bbaumbach
:
review+
Actions:
View
Attachments on
bug 13752
:
14805
|
14806
| 14807 |
14808