summaryrefslogtreecommitdiff
path: root/source4/smbd/service_stream.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-11-15 10:12:22 +1100
committerAndrew Tridgell <tridge@samba.org>2010-11-15 10:19:34 +1100
commitef7f4a142068757dcf0dc11c5b7cf03755be45a8 (patch)
treed8e56b44df249b52da8d913f92293ac39d45be35 /source4/smbd/service_stream.c
parentec590fc9e37c38891bdd10aaae5bac46f5e71f75 (diff)
downloadsamba-ef7f4a142068757dcf0dc11c5b7cf03755be45a8.tar.gz
samba-ef7f4a142068757dcf0dc11c5b7cf03755be45a8.tar.bz2
samba-ef7f4a142068757dcf0dc11c5b7cf03755be45a8.zip
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 <abartlet@samba.org>
Diffstat (limited to 'source4/smbd/service_stream.c')
-rw-r--r--source4/smbd/service_stream.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c
index 85efa34339..916393253b 100644
--- a/source4/smbd/service_stream.c
+++ b/source4/smbd/service_stream.c
@@ -255,7 +255,8 @@ static void stream_accept_handler(struct tevent_context *ev, struct tevent_fd *f
a string for the port. Should leave allocating a port nr
to the socket implementation - JRV20070903
*/
-NTSTATUS stream_setup_socket(struct tevent_context *event_context,
+NTSTATUS stream_setup_socket(TALLOC_CTX *mem_ctx,
+ struct tevent_context *event_context,
struct loadparm_context *lp_ctx,
const struct model_ops *model_ops,
const struct stream_server_ops *stream_ops,
@@ -271,7 +272,7 @@ NTSTATUS stream_setup_socket(struct tevent_context *event_context,
struct tevent_fd *fde;
int i;
- stream_socket = talloc_zero(event_context, struct stream_socket);
+ stream_socket = talloc_zero(mem_ctx, struct stream_socket);
NT_STATUS_HAVE_NO_MEMORY(stream_socket);
status = socket_create(family, SOCKET_TYPE_STREAM, &stream_socket->sock, 0);