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,
};
#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)
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),
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,
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,
*/
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;
}
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),
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),
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,
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),
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),
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);
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),
*/
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;
}
/*
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)
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),
*/
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;
/*
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;
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),
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;
.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,
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;
}
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,
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,
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);
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);
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,
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);
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),
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),
*/
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,
}
} 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);