From ef7f4a142068757dcf0dc11c5b7cf03755be45a8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 Nov 2010 10:12:22 +1100 Subject: s4-server: make server sockets a child of the task context We previously allocated sockets as direct children of the event context. That led to crashes if a service called task_server_terminate(), as it left the socket open and handling events for a dead protocol. Making them a child of the task allows the task to terminate and take all its sockets with it. Pair-Programmed-With: Andrew Bartlett --- source4/smb_server/smb_server.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source4/smb_server/smb_server.c') diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c index 8e54423706..d21e5fbdb0 100644 --- a/source4/smb_server/smb_server.c +++ b/source4/smb_server/smb_server.c @@ -175,10 +175,11 @@ static const struct stream_server_ops smb_stream_ops = { /* setup a listening socket on all the SMB ports for a particular address */ -_PUBLIC_ NTSTATUS smbsrv_add_socket(struct tevent_context *event_context, +_PUBLIC_ NTSTATUS smbsrv_add_socket(TALLOC_CTX *mem_ctx, + struct tevent_context *event_context, struct loadparm_context *lp_ctx, - const struct model_ops *model_ops, - const char *address) + const struct model_ops *model_ops, + const char *address) { const char **ports = lpcfg_smb_ports(lp_ctx); int i; @@ -187,7 +188,7 @@ _PUBLIC_ NTSTATUS smbsrv_add_socket(struct tevent_context *event_context, for (i=0;ports[i];i++) { uint16_t port = atoi(ports[i]); if (port == 0) continue; - status = stream_setup_socket(event_context, lp_ctx, + status = stream_setup_socket(mem_ctx, event_context, lp_ctx, model_ops, &smb_stream_ops, "ipv4", address, &port, lpcfg_socket_options(lp_ctx), -- cgit