diff options
author | Jeremy Allison <jra@samba.org> | 2017-03-29 11:11:37 -0700 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2017-03-31 14:48:17 +0200 |
commit | 3a9ea1873ca8e07fad18d5aa07097f8ead335270 (patch) | |
tree | eb3085a37b1b2530b4dae0c743425c56f235f71d /source4/smbd | |
parent | 5f4979509950547e68af7f64ac263d0e0705ee03 (diff) | |
download | samba-3a9ea1873ca8e07fad18d5aa07097f8ead335270.tar.gz |
s4: messaging. Add imessaging_reinit_all() function.
Ensure it is called from process_standard.c after
every fork().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Mar 31 14:48:17 CEST 2017 on sn-devel-144
Diffstat (limited to 'source4/smbd')
-rw-r--r-- | source4/smbd/process_standard.c | 14 | ||||
-rw-r--r-- | source4/smbd/wscript_build | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c index 18946577e56..ca93f93ce55 100644 --- a/source4/smbd/process_standard.c +++ b/source4/smbd/process_standard.c @@ -28,6 +28,7 @@ #include "cluster/cluster.h" #include "param/param.h" #include "ldb_wrap.h" +#include "lib/messaging/messaging.h" struct standard_child_state { const char *name; @@ -270,6 +271,12 @@ static void standard_accept_connection(struct tevent_context *ev, /* tdb needs special fork handling */ ldb_wrap_fork_hook(); + /* Must be done after a fork() to reset messaging contexts. */ + status = imessaging_reinit_all(); + if (!NT_STATUS_IS_OK(status)) { + smb_panic("Failed to re-initialise imessaging after fork"); + } + tevent_add_fd(ev, ev, child_pipe[0], TEVENT_FD_READ, standard_pipe_handler, NULL); if (child_pipe[1] != -1) { @@ -309,6 +316,7 @@ static void standard_new_task(struct tevent_context *ev, void *private_data) { pid_t pid; + NTSTATUS status; struct standard_child_state *state; state = setup_standard_child_pipe(ev, service_name); @@ -346,6 +354,12 @@ static void standard_new_task(struct tevent_context *ev, /* ldb/tdb need special fork handling */ ldb_wrap_fork_hook(); + /* Must be done after a fork() to reset messaging contexts. */ + status = imessaging_reinit_all(); + if (!NT_STATUS_IS_OK(status)) { + smb_panic("Failed to re-initialise imessaging after fork"); + } + tevent_add_fd(ev, ev, child_pipe[0], TEVENT_FD_READ, standard_pipe_handler, NULL); if (child_pipe[1] != -1) { diff --git a/source4/smbd/wscript_build b/source4/smbd/wscript_build index 98220d04358..ca2039694a4 100644 --- a/source4/smbd/wscript_build +++ b/source4/smbd/wscript_build @@ -40,7 +40,7 @@ bld.SAMBA_MODULE('process_model_standard', source='process_standard.c', subsystem='process_model', init_function='process_model_standard_init', - deps='events ldbsamba process_model samba-sockets cluster', + deps='MESSAGING events ldbsamba process_model samba-sockets cluster', internal_module=False ) |