summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/dns_server/dns_server.c3
-rw-r--r--source4/ldap_server/ldap_server.c18
-rw-r--r--source4/ntp_signd/ntp_signd.c3
-rw-r--r--source4/rpc_server/dcerpc_server.c8
-rw-r--r--source4/smb_server/service_smb.c4
-rw-r--r--source4/smb_server/smb_samba3.c11
-rw-r--r--source4/smb_server/smb_server.c9
-rw-r--r--source4/smb_server/smb_server.h7
-rw-r--r--source4/smbd/service_named_pipe.c8
-rw-r--r--source4/smbd/service_stream.c5
-rw-r--r--source4/torture/rpc/spoolss_notify.c2
-rw-r--r--source4/web_server/web_server.c5
-rw-r--r--source4/winbind/wb_server.c4
-rw-r--r--source4/wrepl_server/wrepl_in_connection.c4
14 files changed, 52 insertions, 39 deletions
diff --git a/source4/dns_server/dns_server.c b/source4/dns_server/dns_server.c
index 8e37fc21d3..fc343ba058 100644
--- a/source4/dns_server/dns_server.c
+++ b/source4/dns_server/dns_server.c
@@ -492,7 +492,8 @@ static NTSTATUS dns_add_socket(struct dns_server *dns,
return status;
}
- status = stream_setup_socket(dns->task->event_ctx,
+ status = stream_setup_socket(dns->task,
+ dns->task->event_ctx,
dns->task->lp_ctx,
model_ops,
&dns_tcp_stream_ops,
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index eec505fdc5..67fe18330f 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -797,10 +797,12 @@ static const struct stream_server_ops ldap_stream_priv_ops = {
};
#endif
+
+
/*
add a socket address to the list of events, one event per port
*/
-static NTSTATUS add_socket(struct tevent_context *event_context,
+static NTSTATUS add_socket(struct task_server *task,
struct loadparm_context *lp_ctx,
const struct model_ops *model_ops,
const char *address, struct ldapsrv_service *ldap_service)
@@ -809,7 +811,7 @@ static NTSTATUS add_socket(struct tevent_context *event_context,
NTSTATUS status;
struct ldb_context *ldb;
- status = stream_setup_socket(event_context, lp_ctx,
+ status = stream_setup_socket(task, task->event_ctx, lp_ctx,
model_ops, &ldap_stream_nonpriv_ops,
"ipv4", address, &port,
lpcfg_socket_options(lp_ctx),
@@ -823,7 +825,7 @@ static NTSTATUS add_socket(struct tevent_context *event_context,
if (tstream_tls_params_enabled(ldap_service->tls_params)) {
/* add ldaps server */
port = 636;
- status = stream_setup_socket(event_context, lp_ctx,
+ status = stream_setup_socket(task, task->event_ctx, lp_ctx,
model_ops,
&ldap_stream_nonpriv_ops,
"ipv4", address, &port,
@@ -845,7 +847,7 @@ static NTSTATUS add_socket(struct tevent_context *event_context,
if (samdb_is_gc(ldb)) {
port = 3268;
- status = stream_setup_socket(event_context, lp_ctx,
+ status = stream_setup_socket(task, task->event_ctx, lp_ctx,
model_ops,
&ldap_stream_nonpriv_ops,
"ipv4", address, &port,
@@ -941,11 +943,11 @@ static void ldapsrv_task_init(struct task_server *task)
*/
for(i = 0; i < num_interfaces; i++) {
const char *address = iface_n_ip(ifaces, i);
- status = add_socket(task->event_ctx, task->lp_ctx, model_ops, address, ldap_service);
+ status = add_socket(task, task->lp_ctx, model_ops, address, ldap_service);
if (!NT_STATUS_IS_OK(status)) goto failed;
}
} else {
- status = add_socket(task->event_ctx, task->lp_ctx, model_ops,
+ status = add_socket(task, task->lp_ctx, model_ops,
lpcfg_socket_address(task->lp_ctx), ldap_service);
if (!NT_STATUS_IS_OK(status)) goto failed;
}
@@ -955,7 +957,7 @@ static void ldapsrv_task_init(struct task_server *task)
goto failed;
}
- status = stream_setup_socket(task->event_ctx, task->lp_ctx,
+ status = stream_setup_socket(task, task->event_ctx, task->lp_ctx,
model_ops, &ldap_stream_nonpriv_ops,
"unix", ldapi_path, NULL,
lpcfg_socket_options(task->lp_ctx),
@@ -986,7 +988,7 @@ static void ldapsrv_task_init(struct task_server *task)
goto failed;
}
- status = stream_setup_socket(task->event_ctx, task->lp_ctx,
+ status = stream_setup_socket(task, task->event_ctx, task->lp_ctx,
model_ops, &ldap_stream_priv_ops,
"unix", ldapi_path, NULL,
lpcfg_socket_options(task->lp_ctx),
diff --git a/source4/ntp_signd/ntp_signd.c b/source4/ntp_signd/ntp_signd.c
index a0dd2d3065..71b9a9dbc2 100644
--- a/source4/ntp_signd/ntp_signd.c
+++ b/source4/ntp_signd/ntp_signd.c
@@ -528,7 +528,8 @@ static void ntp_signd_task_init(struct task_server *task)
address = talloc_asprintf(ntp_signd, "%s/socket", lpcfg_ntp_signd_socket_directory(task->lp_ctx));
- status = stream_setup_socket(ntp_signd->task->event_ctx,
+ status = stream_setup_socket(ntp_signd->task,
+ ntp_signd->task->event_ctx,
ntp_signd->task->lp_ctx,
model_ops,
&ntp_signd_stream_ops,
diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c
index 061d8e80b2..1371ad9b36 100644
--- a/source4/rpc_server/dcerpc_server.c
+++ b/source4/rpc_server/dcerpc_server.c
@@ -1538,7 +1538,7 @@ static NTSTATUS dcesrv_add_ep_unix(struct dcesrv_context *dce_ctx,
dcesrv_sock->endpoint = e;
dcesrv_sock->dcesrv_ctx = talloc_reference(dcesrv_sock, dce_ctx);
- status = stream_setup_socket(event_ctx, lp_ctx,
+ status = stream_setup_socket(dcesrv_sock, event_ctx, lp_ctx,
model_ops, &dcesrv_stream_ops,
"unix", e->ep_description->endpoint, &port,
lpcfg_socket_options(lp_ctx),
@@ -1578,7 +1578,7 @@ static NTSTATUS dcesrv_add_ep_ncalrpc(struct dcesrv_context *dce_ctx,
dcesrv_sock->endpoint = e;
dcesrv_sock->dcesrv_ctx = talloc_reference(dcesrv_sock, dce_ctx);
- status = stream_setup_socket(event_ctx, lp_ctx,
+ status = stream_setup_socket(dcesrv_sock, event_ctx, lp_ctx,
model_ops, &dcesrv_stream_ops,
"unix", full_path, &port,
lpcfg_socket_options(lp_ctx),
@@ -1610,7 +1610,7 @@ static NTSTATUS dcesrv_add_ep_np(struct dcesrv_context *dce_ctx,
dcesrv_sock->endpoint = e;
dcesrv_sock->dcesrv_ctx = talloc_reference(dcesrv_sock, dce_ctx);
- status = tstream_setup_named_pipe(event_ctx, lp_ctx,
+ status = tstream_setup_named_pipe(dce_ctx, event_ctx, lp_ctx,
model_ops, &dcesrv_stream_ops,
e->ep_description->endpoint,
dcesrv_sock);
@@ -1645,7 +1645,7 @@ static NTSTATUS add_socket_rpc_tcp_iface(struct dcesrv_context *dce_ctx, struct
dcesrv_sock->endpoint = e;
dcesrv_sock->dcesrv_ctx = talloc_reference(dcesrv_sock, dce_ctx);
- status = stream_setup_socket(event_ctx, dce_ctx->lp_ctx,
+ status = stream_setup_socket(dcesrv_sock, event_ctx, dce_ctx->lp_ctx,
model_ops, &dcesrv_stream_ops,
"ipv4", address, &port,
lpcfg_socket_options(dce_ctx->lp_ctx),
diff --git a/source4/smb_server/service_smb.c b/source4/smb_server/service_smb.c
index 54feccbe05..583360bbe7 100644
--- a/source4/smb_server/service_smb.c
+++ b/source4/smb_server/service_smb.c
@@ -58,12 +58,12 @@ static void smbsrv_task_init(struct task_server *task)
*/
for(i = 0; i < num_interfaces; i++) {
const char *address = iface_n_ip(ifaces, i);
- status = smbsrv_add_socket(task->event_ctx, task->lp_ctx, task->model_ops, address);
+ status = smbsrv_add_socket(task, task->event_ctx, task->lp_ctx, task->model_ops, address);
if (!NT_STATUS_IS_OK(status)) goto failed;
}
} else {
/* Just bind to lpcfg_socket_address() (usually 0.0.0.0) */
- status = smbsrv_add_socket(task->event_ctx, task->lp_ctx, task->model_ops,
+ status = smbsrv_add_socket(task, task->event_ctx, task->lp_ctx, task->model_ops,
lpcfg_socket_address(task->lp_ctx));
if (!NT_STATUS_IS_OK(status)) goto failed;
}
diff --git a/source4/smb_server/smb_samba3.c b/source4/smb_server/smb_samba3.c
index ee12480c39..ed9027afac 100644
--- a/source4/smb_server/smb_samba3.c
+++ b/source4/smb_server/smb_samba3.c
@@ -86,7 +86,8 @@ static const struct stream_server_ops samba3_smb_stream_ops = {
/*
setup a listening socket on all the SMB ports for a particular address
*/
-static NTSTATUS samba3_add_socket(struct tevent_context *event_context,
+static NTSTATUS samba3_add_socket(struct task_server *task,
+ struct tevent_context *event_context,
struct loadparm_context *lp_ctx,
const struct model_ops *model_ops,
const char *address)
@@ -98,7 +99,7 @@ static NTSTATUS samba3_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(task, event_context, lp_ctx,
model_ops, &samba3_smb_stream_ops,
"ip", address, &port,
lpcfg_socket_options(lp_ctx),
@@ -142,14 +143,16 @@ static void samba3_smb_task_init(struct task_server *task)
*/
for(i = 0; i < num_interfaces; i++) {
const char *address = iface_n_ip(ifaces, i);
- status = samba3_add_socket(task->event_ctx,
+ status = samba3_add_socket(task,
+ task->event_ctx,
task->lp_ctx,
model_ops, address);
if (!NT_STATUS_IS_OK(status)) goto failed;
}
} else {
/* Just bind to lpcfg_socket_address() (usually 0.0.0.0) */
- status = samba3_add_socket(task->event_ctx, task->lp_ctx,
+ status = samba3_add_socket(task,
+ task->event_ctx, task->lp_ctx,
model_ops,
lpcfg_socket_address(task->lp_ctx));
if (!NT_STATUS_IS_OK(status)) goto failed;
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),
diff --git a/source4/smb_server/smb_server.h b/source4/smb_server/smb_server.h
index 4399dc8c70..6088853743 100644
--- a/source4/smb_server/smb_server.h
+++ b/source4/smb_server/smb_server.h
@@ -395,10 +395,11 @@ struct smbsrv_connection {
struct model_ops;
struct loadparm_context;
-NTSTATUS smbsrv_add_socket(struct tevent_context *event_context,
+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);
struct loadparm_context;
diff --git a/source4/smbd/service_named_pipe.c b/source4/smbd/service_named_pipe.c
index f420e2bacb..25d37af8c4 100644
--- a/source4/smbd/service_named_pipe.c
+++ b/source4/smbd/service_named_pipe.c
@@ -289,7 +289,8 @@ static const struct stream_server_ops named_pipe_stream_ops = {
.send_handler = named_pipe_send,
};
-NTSTATUS tstream_setup_named_pipe(struct tevent_context *event_context,
+NTSTATUS tstream_setup_named_pipe(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,
@@ -300,7 +301,7 @@ NTSTATUS tstream_setup_named_pipe(struct tevent_context *event_context,
struct named_pipe_socket *pipe_sock;
NTSTATUS status = NT_STATUS_NO_MEMORY;;
- pipe_sock = talloc(event_context, struct named_pipe_socket);
+ pipe_sock = talloc(mem_ctx, struct named_pipe_socket);
if (pipe_sock == NULL) {
goto fail;
}
@@ -338,7 +339,8 @@ NTSTATUS tstream_setup_named_pipe(struct tevent_context *event_context,
pipe_sock->ops = stream_ops;
pipe_sock->private_data = private_data;
- status = stream_setup_socket(event_context,
+ status = stream_setup_socket(pipe_sock,
+ event_context,
lp_ctx,
model_ops,
&named_pipe_stream_ops,
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);
diff --git a/source4/torture/rpc/spoolss_notify.c b/source4/torture/rpc/spoolss_notify.c
index facfd3e52a..a613e31a9e 100644
--- a/source4/torture/rpc/spoolss_notify.c
+++ b/source4/torture/rpc/spoolss_notify.c
@@ -464,7 +464,7 @@ static bool test_start_dcerpc_server(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, status,
"unable to initialize process models");
- status = smbsrv_add_socket(event_ctx, tctx->lp_ctx, process_model_startup("single"), address);
+ status = smbsrv_add_socket(tctx, event_ctx, tctx->lp_ctx, process_model_startup("single"), address);
torture_assert_ntstatus_ok(tctx, status, "starting smb server");
status = dcesrv_init_context(tctx, tctx->lp_ctx, endpoints, &dce_ctx);
diff --git a/source4/web_server/web_server.c b/source4/web_server/web_server.c
index 97e65e5a47..4cc2cb8d38 100644
--- a/source4/web_server/web_server.c
+++ b/source4/web_server/web_server.c
@@ -320,7 +320,8 @@ static void websrv_task_init(struct task_server *task)
num_interfaces = iface_count(ifaces);
for(i = 0; i < num_interfaces; i++) {
const char *address = iface_n_ip(ifaces, i);
- status = stream_setup_socket(task->event_ctx,
+ status = stream_setup_socket(task,
+ task->event_ctx,
task->lp_ctx, model_ops,
&web_stream_ops,
"ipv4", address,
@@ -331,7 +332,7 @@ static void websrv_task_init(struct task_server *task)
talloc_free(ifaces);
} else {
- status = stream_setup_socket(task->event_ctx, task->lp_ctx,
+ status = stream_setup_socket(task, task->event_ctx, task->lp_ctx,
model_ops, &web_stream_ops,
"ipv4", lpcfg_socket_address(task->lp_ctx),
&port, lpcfg_socket_options(task->lp_ctx), task);
diff --git a/source4/winbind/wb_server.c b/source4/winbind/wb_server.c
index 34d145d318..5390dab2f7 100644
--- a/source4/winbind/wb_server.c
+++ b/source4/winbind/wb_server.c
@@ -299,7 +299,7 @@ static void winbind_task_init(struct task_server *task)
if (!listen_socket->socket_path) goto nomem;
listen_socket->service = service;
listen_socket->privileged = false;
- status = stream_setup_socket(task->event_ctx, task->lp_ctx, model_ops,
+ status = stream_setup_socket(task, task->event_ctx, task->lp_ctx, model_ops,
&wbsrv_ops, "unix",
listen_socket->socket_path, &port,
lpcfg_socket_options(task->lp_ctx),
@@ -316,7 +316,7 @@ static void winbind_task_init(struct task_server *task)
if (!listen_socket->socket_path) goto nomem;
listen_socket->service = service;
listen_socket->privileged = true;
- status = stream_setup_socket(task->event_ctx, task->lp_ctx, model_ops,
+ status = stream_setup_socket(task, task->event_ctx, task->lp_ctx, model_ops,
&wbsrv_ops, "unix",
listen_socket->socket_path, &port,
lpcfg_socket_options(task->lp_ctx),
diff --git a/source4/wrepl_server/wrepl_in_connection.c b/source4/wrepl_server/wrepl_in_connection.c
index 632c9a9a5b..3e2faa23e5 100644
--- a/source4/wrepl_server/wrepl_in_connection.c
+++ b/source4/wrepl_server/wrepl_in_connection.c
@@ -451,7 +451,7 @@ NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service, struct loadpar
*/
for(i = 0; i < num_interfaces; i++) {
address = iface_n_ip(ifaces, i);
- status = stream_setup_socket(task->event_ctx,
+ status = stream_setup_socket(task, task->event_ctx,
task->lp_ctx, model_ops,
&wreplsrv_stream_ops,
"ipv4", address, &port,
@@ -465,7 +465,7 @@ NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service, struct loadpar
}
} else {
address = lpcfg_socket_address(lp_ctx);
- status = stream_setup_socket(task->event_ctx, task->lp_ctx,
+ 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);