diff options
author | Gary Lockyer <gary@catalyst.net.nz> | 2017-09-15 07:09:23 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2017-10-19 05:33:09 +0200 |
commit | b852ad044b98c0c574c3420956e153055d46136d (patch) | |
tree | 4246355fbade866ba399d3e6266b7572df953b09 /source4/wrepl_server | |
parent | 6d7a8d80cdc9ee996ff503d8834037001cf233d9 (diff) | |
download | samba-b852ad044b98c0c574c3420956e153055d46136d.tar.gz |
source4/smbd: refactor the process model for prefork
Refactor the process model code to allow the addition of a prefork
process model.
- Add a process context to contain process model specific state
- Add a service details structure to allow service to indicate which
process model options they can support.
In the new code the services advertise the features they support to the
process model. The process model context is plumbed through to allow the
process model to keep track of the supported options, and any state
the process model may require.
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'source4/wrepl_server')
-rw-r--r-- | source4/wrepl_server/wrepl_in_connection.c | 10 | ||||
-rw-r--r-- | source4/wrepl_server/wrepl_out_helpers.c | 4 | ||||
-rw-r--r-- | source4/wrepl_server/wrepl_server.c | 7 |
3 files changed, 15 insertions, 6 deletions
diff --git a/source4/wrepl_server/wrepl_in_connection.c b/source4/wrepl_server/wrepl_in_connection.c index b8e9a16dc21..4920aa0328f 100644 --- a/source4/wrepl_server/wrepl_in_connection.c +++ b/source4/wrepl_server/wrepl_in_connection.c @@ -347,7 +347,8 @@ static const struct stream_server_ops wreplsrv_stream_ops = { NTSTATUS wreplsrv_in_connection_merge(struct wreplsrv_partner *partner, uint32_t peer_assoc_ctx, struct tstream_context **stream, - struct wreplsrv_in_connection **_wrepl_in) + struct wreplsrv_in_connection **_wrepl_in, + void* process_context) { struct wreplsrv_service *service = partner->service; struct wreplsrv_in_connection *wrepl_in; @@ -379,7 +380,8 @@ NTSTATUS wreplsrv_in_connection_merge(struct wreplsrv_partner *partner, &wreplsrv_stream_ops, service->task->msg_ctx, wrepl_in, - &conn); + &conn, + process_context); NT_STATUS_NOT_OK_RETURN(status); /* @@ -461,7 +463,7 @@ NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service, struct loadpar &wreplsrv_stream_ops, "ipv4", address, &port, lpcfg_socket_options(task->lp_ctx), - service); + service, task->process_context); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("stream_setup_socket(address=%s,port=%u) failed - %s\n", address, port, nt_errstr(status))); @@ -473,7 +475,7 @@ NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service, struct loadpar status = stream_setup_socket(task, task->event_ctx, task->lp_ctx, model_ops, &wreplsrv_stream_ops, "ipv4", address, &port, lpcfg_socket_options(task->lp_ctx), - service); + service, task->process_context); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("stream_setup_socket(address=%s,port=%u) failed - %s\n", address, port, nt_errstr(status))); diff --git a/source4/wrepl_server/wrepl_out_helpers.c b/source4/wrepl_server/wrepl_out_helpers.c index 782e2f2908f..0e3f0a458ba 100644 --- a/source4/wrepl_server/wrepl_out_helpers.c +++ b/source4/wrepl_server/wrepl_out_helpers.c @@ -988,6 +988,7 @@ static NTSTATUS wreplsrv_push_notify_wait_update(struct wreplsrv_push_notify_sta { struct wreplsrv_in_connection *wrepl_in; struct tstream_context *stream; + void *process_context = NULL; NTSTATUS status; status = wrepl_request_recv(state->subreq, state, NULL); @@ -1011,10 +1012,11 @@ static NTSTATUS wreplsrv_push_notify_wait_update(struct wreplsrv_push_notify_sta * NOTE: stream will be stolen by * wreplsrv_in_connection_merge() */ + process_context = state->io->in.partner->service->task->process_context; status = wreplsrv_in_connection_merge(state->io->in.partner, state->wreplconn->assoc_ctx.peer_ctx, &stream, - &wrepl_in); + &wrepl_in, process_context); NT_STATUS_NOT_OK_RETURN(status); /* now we can free the wreplsrv_out_connection */ diff --git a/source4/wrepl_server/wrepl_server.c b/source4/wrepl_server/wrepl_server.c index dc28e23371e..bd2ae2660a0 100644 --- a/source4/wrepl_server/wrepl_server.c +++ b/source4/wrepl_server/wrepl_server.c @@ -508,5 +508,10 @@ static void wreplsrv_task_init(struct task_server *task) */ NTSTATUS server_service_wrepl_init(TALLOC_CTX *ctx) { - return register_server_service(ctx, "wrepl", wreplsrv_task_init); + struct service_details details = { + .inhibit_fork_on_accept = true, + .inhibit_pre_fork = true + }; + return register_server_service(ctx, "wrepl", wreplsrv_task_init, + &details); } |