setup our listening sockets on the configured network interfaces
*/
static NTSTATUS dns_startup_interfaces(struct dns_server *dns,
- struct interface *ifaces)
+ struct interface *ifaces,
+ const struct model_ops *model_ops)
{
- const struct model_ops *model_ops;
int num_interfaces;
TALLOC_CTX *tmp_ctx = talloc_new(dns);
NTSTATUS status;
int i;
- /* within the dns task we want to be a single process, so
- ask for the single process model ops and pass these to the
- stream_setup_socket() call. */
- model_ops = process_model_startup("single");
- if (!model_ops) {
- DEBUG(0,("Can't find 'single' process model_ops\n"));
- return NT_STATUS_INTERNAL_ERROR;
- }
-
if (ifaces != NULL) {
num_interfaces = iface_list_count(ifaces);
return;
}
- status = dns_startup_interfaces(dns, ifaces);
+ status = dns_startup_interfaces(dns, ifaces, task->model_ops);
if (!NT_STATUS_IS_OK(status)) {
task_server_terminate(task, "dns failed to setup interfaces", true);
return;
/* Set up the listening sockets */
static NTSTATUS echo_startup_interfaces(struct echo_server *echo,
struct loadparm_context *lp_ctx,
- struct interface *ifaces)
+ struct interface *ifaces,
+ const struct model_ops *model_ops)
{
- const struct model_ops *model_ops;
int num_interfaces;
TALLOC_CTX *tmp_ctx = talloc_new(echo);
NTSTATUS status;
int i;
- /*
- * Samba allows subtask to set their own process model.
- * Available models currently are:
- * - onefork (forks exactly one child process)
- * - prefork (keep a couple of child processes around)
- * - single (only run a single process)
- * - standard (fork one subprocess per incoming connection)
- * - thread (use threads instead of forks)
- *
- * For the echo server, the "single" process model works fine,
- * you probably don't want to use the thread model unless you really
- * know what you're doing.
- */
-
- model_ops = process_model_startup("single");
- if (model_ops == NULL) {
- DEBUG(0, ("Can't find 'single' process model_ops\n"));
- return NT_STATUS_INTERNAL_ERROR;
- }
-
num_interfaces = iface_list_count(ifaces);
for(i=0; i<num_interfaces; i++) {
echo->task = task;
- status = echo_startup_interfaces(echo, task->lp_ctx, ifaces);
+ status = echo_startup_interfaces(echo, task->lp_ctx, ifaces,
+ task->model_ops);
if (!NT_STATUS_IS_OK(status)) {
task_server_terminate(task, "echo: Failed to set up interfaces",
true);
/*
setup our listening sockets on the configured network interfaces
*/
-static NTSTATUS kdc_startup_interfaces(struct kdc_server *kdc, struct loadparm_context *lp_ctx,
- struct interface *ifaces)
+static NTSTATUS kdc_startup_interfaces(struct kdc_server *kdc,
+ struct loadparm_context *lp_ctx,
+ struct interface *ifaces,
+ const struct model_ops *model_ops)
{
- const struct model_ops *model_ops;
int num_interfaces;
TALLOC_CTX *tmp_ctx = talloc_new(kdc);
NTSTATUS status;
uint16_t kpasswd_port = lpcfg_kpasswd_port(lp_ctx);
bool done_wildcard = false;
- /* within the kdc task we want to be a single process, so
- ask for the single process model ops and pass these to the
- stream_setup_socket() call. */
- model_ops = process_model_startup("single");
- if (!model_ops) {
- DEBUG(0,("Can't find 'single' process model_ops\n"));
- return NT_STATUS_INTERNAL_ERROR;
- }
-
num_interfaces = iface_list_count(ifaces);
/* if we are allowing incoming packets from any address, then
kdc->private_data = kdc_config;
/* start listening on the configured network interfaces */
- status = kdc_startup_interfaces(kdc, task->lp_ctx, ifaces);
+ status = kdc_startup_interfaces(kdc, task->lp_ctx, ifaces,
+ task->model_ops);
if (!NT_STATUS_IS_OK(status)) {
task_server_terminate(task, "kdc failed to setup interfaces", true);
return;
return NT_STATUS_OK;
}
- model_ops = process_model_startup("single");
- if (model_ops == NULL) {
- DBG_ERR("Can't find 'single' process model_ops\n");
- return NT_STATUS_INTERNAL_ERROR;
- }
-
tmp_ctx = talloc_named_const(mem_ctx, 0, "kpasswd");
if (tmp_ctx == NULL) {
return NT_STATUS_NO_MEMORY;
const char *dns_host_name;
struct ldapsrv_service *ldap_service;
NTSTATUS status;
- const struct model_ops *model_ops;
switch (lpcfg_server_role(task->lp_ctx)) {
case ROLE_STANDALONE:
task_server_set_title(task, "task[ldapsrv]");
- /*
- * Here we used to run the ldap server as a single process,
- * but we don't want transaction locks for one task in a write
- * blocking all other reads, so we go multi-process.
- */
- model_ops = task->model_ops;
-
ldap_service = talloc_zero(task, struct ldapsrv_service);
if (ldap_service == NULL) goto failed;
*/
for(i = 0; i < num_interfaces; i++) {
const char *address = iface_list_n_ip(ifaces, i);
- status = add_socket(task, task->lp_ctx, model_ops, address, ldap_service);
+ status = add_socket(task, task->lp_ctx, task->model_ops,
+ address, ldap_service);
if (!NT_STATUS_IS_OK(status)) goto failed;
}
} else {
goto failed;
}
for (i=0; wcard[i]; i++) {
- status = add_socket(task, task->lp_ctx, model_ops, wcard[i], ldap_service);
+ status = add_socket(task, task->lp_ctx, task->model_ops,
+ wcard[i], ldap_service);
if (NT_STATUS_IS_OK(status)) {
num_binds++;
}
}
status = stream_setup_socket(task, task->event_ctx, task->lp_ctx,
- model_ops, &ldap_stream_nonpriv_ops,
+ task->model_ops, &ldap_stream_nonpriv_ops,
"unix", ldapi_path, NULL,
lpcfg_socket_options(task->lp_ctx),
ldap_service, task->process_context);
}
status = stream_setup_socket(task, task->event_ctx, task->lp_ctx,
- model_ops, &ldap_stream_priv_ops,
+ task->model_ops, &ldap_stream_priv_ops,
"unix", ldapi_path, NULL,
lpcfg_socket_options(task->lp_ctx),
ldap_service,
struct ntp_signd_server *ntp_signd;
NTSTATUS status;
- const struct model_ops *model_ops;
-
const char *address;
if (!directory_create_or_exist_strict(lpcfg_ntp_signd_socket_directory(task->lp_ctx), geteuid(), 0750)) {
return;
}
- /* within the ntp_signd task we want to be a single process, so
- ask for the single process model ops and pass these to the
- stream_setup_socket() call. */
- model_ops = process_model_startup("single");
- if (!model_ops) {
- DEBUG(0,("Can't find 'single' process model_ops\n"));
- return;
- }
-
task_server_set_title(task, "task[ntp_signd]");
ntp_signd = talloc(task, struct ntp_signd_server);
status = stream_setup_socket(ntp_signd->task,
ntp_signd->task->event_ctx,
ntp_signd->task->lp_ctx,
- model_ops,
+ task->model_ops,
&ntp_signd_stream_ops,
"unix", address, NULL,
lpcfg_socket_options(ntp_signd->task->lp_ctx),
{
NTSTATUS status;
uint16_t port = lpcfg_web_port(task->lp_ctx);
- const struct model_ops *model_ops;
struct web_server_data *wdata;
task_server_set_title(task, "task[websrv]");
- /* run the web server as a single process */
- model_ops = process_model_startup("single");
- if (!model_ops) goto failed;
-
/* startup the Python processor - unfortunately we can't do this
per connection as that wouldn't allow for session variables */
wdata = talloc_zero(task, struct web_server_data);
const char *address = iface_list_n_ip(ifaces, i);
status = stream_setup_socket(task,
task->event_ctx,
- task->lp_ctx, model_ops,
- &web_stream_ops,
+ task->lp_ctx,
+ task->model_ops,
+ &web_stream_ops,
"ip", address,
&port,
lpcfg_socket_options(task->lp_ctx),
}
for (i=0; wcard[i]; i++) {
status = stream_setup_socket(task, task->event_ctx,
- task->lp_ctx, model_ops,
+ task->lp_ctx,
+ task->model_ops,
&web_stream_ops,
"ip", wcard[i],
&port, lpcfg_socket_options(task->lp_ctx),
{
struct wreplsrv_service *service = partner->service;
struct wreplsrv_in_connection *wrepl_in;
- const struct model_ops *model_ops;
struct stream_connection *conn;
struct tevent_req *subreq;
NTSTATUS status;
- /* within the wrepl task we want to be a single process, so
- ask for the single process model ops and pass these to the
- stream_setup_socket() call. */
- model_ops = process_model_startup("single");
- if (!model_ops) {
- DEBUG(0,("Can't find 'single' process model_ops"));
- return NT_STATUS_INTERNAL_ERROR;
- }
-
wrepl_in = talloc_zero(partner, struct wreplsrv_in_connection);
NT_STATUS_HAVE_NO_MEMORY(wrepl_in);
status = stream_new_connection_merge(service->task->event_ctx,
service->task->lp_ctx,
- model_ops,
+ service->task->model_ops,
&wreplsrv_stream_ops,
service->task->msg_ctx,
wrepl_in,
{
NTSTATUS status;
struct task_server *task = service->task;
- const struct model_ops *model_ops;
const char *address;
uint16_t port = WINS_REPLICATION_PORT;
- /* within the wrepl task we want to be a single process, so
- ask for the single process model ops and pass these to the
- stream_setup_socket() call. */
- model_ops = process_model_startup("single");
- if (!model_ops) {
- DEBUG(0,("Can't find 'single' process model_ops"));
- return NT_STATUS_INTERNAL_ERROR;
- }
-
if (lpcfg_interfaces(lp_ctx) && lpcfg_bind_interfaces_only(lp_ctx)) {
int num_interfaces;
int i;
continue;
}
address = iface_list_n_ip(ifaces, i);
- 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, task->process_context);
+ status = stream_setup_socket(
+ task, task->event_ctx,
+ task->lp_ctx,
+ task->model_ops,
+ &wreplsrv_stream_ops,
+ "ipv4", address, &port,
+ lpcfg_socket_options(task->lp_ctx),
+ service, task->process_context);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("stream_setup_socket(address=%s,port=%u) failed - %s\n",
address, port, nt_errstr(status)));
}
} else {
address = "0.0.0.0";
- 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),
+ status = stream_setup_socket(task, task->event_ctx,
+ task->lp_ctx, task->model_ops,
+ &wreplsrv_stream_ops,
+ "ipv4", address, &port,
+ lpcfg_socket_options(task->lp_ctx),
service, task->process_context);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("stream_setup_socket(address=%s,port=%u) failed - %s\n",