summaryrefslogtreecommitdiff
path: root/source4/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source4/smbd')
-rw-r--r--source4/smbd/process_single.c2
-rw-r--r--source4/smbd/process_standard.c2
-rw-r--r--source4/smbd/process_thread.c2
-rw-r--r--source4/smbd/server.h1
-rw-r--r--source4/smbd/service.c24
-rw-r--r--source4/smbd/service.h3
6 files changed, 11 insertions, 23 deletions
diff --git a/source4/smbd/process_single.c b/source4/smbd/process_single.c
index 4c0dcd4e35..62d780277c 100644
--- a/source4/smbd/process_single.c
+++ b/source4/smbd/process_single.c
@@ -55,6 +55,8 @@ static void single_accept_connection(struct event_context *ev, struct fd_event *
return;
}
+ talloc_steal(conn, sock);
+
DLIST_ADD(server_socket->connection_list,conn);
/* return to event handling */
diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c
index 22e47d1b1f..1bb30c2ef0 100644
--- a/source4/smbd/process_standard.c
+++ b/source4/smbd/process_standard.c
@@ -80,6 +80,8 @@ static void standard_accept_connection(struct event_context *ev, struct fd_event
return;
}
+ talloc_steal(conn, sock);
+
DLIST_ADD(server_socket->connection_list,conn);
/* return to the event loop */
diff --git a/source4/smbd/process_thread.c b/source4/smbd/process_thread.c
index ef4d53e188..4e11137f37 100644
--- a/source4/smbd/process_thread.c
+++ b/source4/smbd/process_thread.c
@@ -87,6 +87,8 @@ static void thread_accept_connection(struct event_context *ev, struct fd_event *
return;
}
+ talloc_steal(conn, sock);
+
/* TODO: is this MUTEX_LOCK in the right place here?
* --metze
*/
diff --git a/source4/smbd/server.h b/source4/smbd/server.h
index e8c32d01fa..e76adec44d 100644
--- a/source4/smbd/server.h
+++ b/source4/smbd/server.h
@@ -25,7 +25,6 @@ struct server_service;
struct event_context;
struct server_context {
- TALLOC_CTX *mem_ctx;
struct server_service *service_list;
struct event_context *events;
};
diff --git a/source4/smbd/service.c b/source4/smbd/service.c
index 0733e6fc0f..e3eb4a02c1 100644
--- a/source4/smbd/service.c
+++ b/source4/smbd/service.c
@@ -27,7 +27,6 @@ struct server_context *server_service_startup(const char *model)
{
int i;
const char **server_services = lp_server_services();
- TALLOC_CTX *mem_ctx;
struct server_context *srv_ctx;
const struct model_ops *model_ops;
@@ -42,20 +41,12 @@ struct server_context *server_service_startup(const char *model)
return NULL;
}
- mem_ctx = talloc_init("server_context");
- if (!mem_ctx) {
- DEBUG(0,("talloc_init(server_context) failed\n"));
- return NULL;
- }
-
- srv_ctx = talloc_p(mem_ctx, struct server_context);
+ srv_ctx = talloc_p(NULL, struct server_context);
if (!srv_ctx) {
- DEBUG(0,("talloc_p(mem_ctx, struct server_context) failed\n"));
return NULL;
}
ZERO_STRUCTP(srv_ctx);
- srv_ctx->mem_ctx = mem_ctx;
srv_ctx->events = event_context_init();
if (!srv_ctx->events) {
@@ -65,7 +56,6 @@ struct server_context *server_service_startup(const char *model)
for (i=0;server_services[i];i++) {
- TALLOC_CTX *mem_ctx2;
const struct server_service_ops *service_ops;
struct server_service *service;
@@ -75,16 +65,12 @@ struct server_context *server_service_startup(const char *model)
return NULL;
}
- mem_ctx2 = talloc_init("server_service");
-
- service = talloc_p(mem_ctx2, struct server_service);
+ service = talloc_p(srv_ctx, struct server_service);
if (!service) {
- DEBUG(0,("talloc_p(mem_ctx, struct server_service) failed\n"));
return NULL;
}
ZERO_STRUCTP(service);
- service->mem_ctx = mem_ctx2;
service->ops = service_ops;
service->model_ops = model_ops;
service->srv_ctx = srv_ctx;
@@ -129,6 +115,8 @@ struct server_socket *service_setup_socket(struct server_service *service,
return NULL;
}
+ talloc_steal(service, socket_ctx);
+
/* ready to listen */
status = socket_set_option(socket_ctx, "SO_KEEPALIVE SO_REUSEADDR=1", NULL);
if (!NT_STATUS_IS_OK(status)) {
@@ -169,7 +157,6 @@ struct server_socket *service_setup_socket(struct server_service *service,
fde.handler = model_ops->accept_connection;
ZERO_STRUCTP(srv_sock);
- srv_sock->mem_ctx = srv_sock;
srv_sock->service = service;
srv_sock->socket = socket_ctx;
srv_sock->event.ctx = service->srv_ctx->events;
@@ -201,7 +188,6 @@ struct server_connection *server_setup_connection(struct event_context *ev,
}
ZERO_STRUCTP(srv_conn);
- srv_conn->mem_ctx = srv_conn;
fde.private = srv_conn;
fde.fd = socket_get_fd(sock);
@@ -255,7 +241,7 @@ void server_destroy_connection(struct server_connection *srv_conn)
event_remove_timed(srv_conn->event.ctx, srv_conn->event.idle);
srv_conn->event.idle = NULL;
- talloc_destroy(srv_conn->mem_ctx);
+ talloc_free(srv_conn);
}
void server_io_handler(struct event_context *ev, struct fd_event *fde, time_t t, uint16_t flags)
diff --git a/source4/smbd/service.h b/source4/smbd/service.h
index 5d72d388fd..88618964ce 100644
--- a/source4/smbd/service.h
+++ b/source4/smbd/service.h
@@ -67,7 +67,6 @@ struct socket_context;
struct server_socket {
struct server_socket *next,*prev;
- TALLOC_CTX *mem_ctx;
void *private_data;
struct {
@@ -84,7 +83,6 @@ struct server_socket {
struct server_service {
struct server_service *next,*prev;
- TALLOC_CTX *mem_ctx;
void *private_data;
const struct server_service_ops *ops;
@@ -97,7 +95,6 @@ struct server_service {
struct server_connection {
struct server_connection *next,*prev;
- TALLOC_CTX *mem_ctx;
void *private_data;
struct {