From: Gary Lockyer Date: Mon, 3 Sep 2018 22:09:38 +0000 (+1200) Subject: source4 smbd process: pass the fatal flag to terminate X-Git-Tag: tdb-1.3.17~654 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3315a28ea92438eca499fb87b863cbd2db50a6a6;p=thirdparty%2Fsamba.git source4 smbd process: pass the fatal flag to terminate Pass the fatal flag supplied to task_server_terminate to the process task_terminate method. It will be used by the task_terminate methods to set an appropriate exit code. The process_prefork model will use a non zero exit code to indicate that the process should be restarted. Signed-off-by: Gary Lockyer Reviewed-by: Andrew Bartlett --- diff --git a/source4/smbd/process_model.h b/source4/smbd/process_model.h index 17d70254cf2..2a226cef8cb 100644 --- a/source4/smbd/process_model.h +++ b/source4/smbd/process_model.h @@ -69,7 +69,8 @@ struct model_ops { void (*terminate)(struct tevent_context *, struct loadparm_context *lp_ctx, const char *reason, - void * process_context); + bool fatal, + void *process_context); /* function to set a title for the connection or task */ void (*set_title)(struct tevent_context *, const char *title); diff --git a/source4/smbd/process_prefork.c b/source4/smbd/process_prefork.c index 4423b4674e4..c470820efb8 100644 --- a/source4/smbd/process_prefork.c +++ b/source4/smbd/process_prefork.c @@ -534,6 +534,7 @@ static void prefork_new_task( static void prefork_terminate(struct tevent_context *ev, struct loadparm_context *lp_ctx, const char *reason, + bool fatal, void *process_context) { DBG_DEBUG("called with reason[%s]\n", reason); diff --git a/source4/smbd/process_single.c b/source4/smbd/process_single.c index 174c1572812..061f09673dd 100644 --- a/source4/smbd/process_single.c +++ b/source4/smbd/process_single.c @@ -124,6 +124,7 @@ static void single_new_task(struct tevent_context *ev, static void single_terminate(struct tevent_context *ev, struct loadparm_context *lp_ctx, const char *reason, + bool fatal, void *process_context) { DBG_NOTICE("single_terminate: reason[%s]\n",reason); diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c index 91dfa9753c5..536a6be3007 100644 --- a/source4/smbd/process_standard.c +++ b/source4/smbd/process_standard.c @@ -513,6 +513,7 @@ static void standard_new_task(struct tevent_context *ev, static void standard_terminate(struct tevent_context *ev, struct loadparm_context *lp_ctx, const char *reason, + bool fatal, void *process_context) { struct process_context *proc_ctx = NULL; diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c index fc996d942e6..336a0cb32aa 100644 --- a/source4/smbd/service_stream.c +++ b/source4/smbd/service_stream.c @@ -57,6 +57,7 @@ void stream_terminate_connection(struct stream_connection *srv_conn, const char const struct model_ops *model_ops = srv_conn->model_ops; struct loadparm_context *lp_ctx = srv_conn->lp_ctx; void *process_context = srv_conn->process_context; + bool fatal = true; TALLOC_CTX *frame = NULL; if (!reason) reason = "unknown reason"; @@ -91,7 +92,7 @@ void stream_terminate_connection(struct stream_connection *srv_conn, const char srv_conn->event.fde = NULL; imessaging_cleanup(srv_conn->msg_ctx); TALLOC_FREE(srv_conn); - model_ops->terminate(event_ctx, lp_ctx, reason, process_context); + model_ops->terminate(event_ctx, lp_ctx, reason, fatal, process_context); TALLOC_FREE(frame); } diff --git a/source4/smbd/service_task.c b/source4/smbd/service_task.c index 15e480ec043..cb1f4d5ad1f 100644 --- a/source4/smbd/service_task.c +++ b/source4/smbd/service_task.c @@ -54,8 +54,8 @@ void task_server_terminate(struct task_server *task, const char *reason, bool fa imessaging_cleanup(task->msg_ctx); - model_ops->terminate(event_ctx, task->lp_ctx, reason, - task->process_context); + model_ops->terminate( + event_ctx, task->lp_ctx, reason, fatal, task->process_context); /* don't free this above, it might contain the 'reason' being printed */ talloc_free(task); }