summaryrefslogtreecommitdiff
path: root/source4/smbd
diff options
context:
space:
mode:
authorGary Lockyer <gary@catalyst.net.nz>2018-09-04 10:09:38 +1200
committerAndrew Bartlett <abartlet@samba.org>2018-11-23 08:25:19 +0100
commit3315a28ea92438eca499fb87b863cbd2db50a6a6 (patch)
treeba5a6ef1c0df4b1b77fa1d5ab39e21e6cd198257 /source4/smbd
parentd4641c8f76b7764f81ce246d2a2b8103593d0dac (diff)
downloadsamba-3315a28ea92438eca499fb87b863cbd2db50a6a6.tar.gz
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 <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/smbd')
-rw-r--r--source4/smbd/process_model.h3
-rw-r--r--source4/smbd/process_prefork.c1
-rw-r--r--source4/smbd/process_single.c1
-rw-r--r--source4/smbd/process_standard.c1
-rw-r--r--source4/smbd/service_stream.c3
-rw-r--r--source4/smbd/service_task.c4
6 files changed, 9 insertions, 4 deletions
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);
}