}
wbconn->conn = conn;
wbconn->listen_socket = listen_socket;
+ wbconn->lp_ctx = listen_socket->service->task->lp_ctx;
conn->private = wbconn;
wbconn->packet = packet_init(wbconn);
}
/* Make sure the directory for the Samba3 socket exists, and is of the correct permissions */
- if (!directory_create_or_exist(lp_winbindd_socket_directory(global_loadparm), geteuid(), 0755)) {
+ if (!directory_create_or_exist(lp_winbindd_socket_directory(task->lp_ctx), geteuid(), 0755)) {
task_server_terminate(task,
"Cannot create winbindd pipe directory");
return;
}
+ /* Make sure the directory for the Samba3 socket exists, and is of the correct permissions */
+ if (!directory_create_or_exist(lp_winbindd_privileged_socket_directory(task->lp_ctx), geteuid(), 0750)) {
+ task_server_terminate(task,
+ "Cannot create winbindd privileged pipe directory");
+ return;
+ }
+
service = talloc_zero(task, struct wbsrv_service);
if (!service) goto nomem;
service->task = task;
service->primary_sid = secrets_get_domain_sid(service,
- lp_workgroup(global_loadparm));
+ task->event_ctx,
+ task->lp_ctx,
+ lp_workgroup(task->lp_ctx));
if (service->primary_sid == NULL) {
task_server_terminate(
task, nt_errstr(NT_STATUS_CANT_ACCESS_DOMAIN_INFO));
return;
}
+ service->idmap_ctx = idmap_init(service, task->event_ctx, task->lp_ctx);
+ if (service->idmap_ctx == NULL) {
+ task_server_terminate(task, "Failed to load idmap database");
+ return;
+ }
+
/* setup the unprivileged samba3 socket */
listen_socket = talloc(service, struct wbsrv_listen_socket);
if (!listen_socket) goto nomem;
listen_socket->socket_path = talloc_asprintf(listen_socket, "%s/%s",
- lp_winbindd_socket_directory(global_loadparm),
+ lp_winbindd_socket_directory(task->lp_ctx),
WINBINDD_SAMBA3_SOCKET);
if (!listen_socket->socket_path) goto nomem;
listen_socket->service = service;
- listen_socket->privileged = False;
- status = stream_setup_socket(task->event_ctx, model_ops,
+ listen_socket->privileged = false;
+ status = stream_setup_socket(task->event_ctx, task->lp_ctx, model_ops,
&wbsrv_ops, "unix",
listen_socket->socket_path, &port,
+ lp_socket_options(task->lp_ctx),
listen_socket);
if (!NT_STATUS_IS_OK(status)) goto listen_failed;
/* setup the privileged samba3 socket */
listen_socket = talloc(service, struct wbsrv_listen_socket);
if (!listen_socket) goto nomem;
- listen_socket->socket_path =
- smbd_tmp_path(listen_socket, global_loadparm,
- WINBINDD_SAMBA3_PRIVILEGED_SOCKET);
+ listen_socket->socket_path
+ = service->priv_socket_path
+ = talloc_asprintf(listen_socket, "%s/%s",
+ lp_winbindd_privileged_socket_directory(task->lp_ctx),
+ WINBINDD_SAMBA3_SOCKET);
+ if (!listen_socket->socket_path) goto nomem;
if (!listen_socket->socket_path) goto nomem;
listen_socket->service = service;
- listen_socket->privileged = True;
- status = stream_setup_socket(task->event_ctx, model_ops,
+ listen_socket->privileged = true;
+ status = stream_setup_socket(task->event_ctx, task->lp_ctx, model_ops,
&wbsrv_ops, "unix",
listen_socket->socket_path, &port,
+ lp_socket_options(task->lp_ctx),
listen_socket);
if (!NT_STATUS_IS_OK(status)) goto listen_failed;
return;
}
-/*
- initialise the winbind server
- */
-static NTSTATUS winbind_init(struct event_context *event_ctx,
- const struct model_ops *model_ops)
-{
- return task_server_startup(event_ctx, model_ops, winbind_task_init);
-}
-
/*
register ourselves as a available server
*/
NTSTATUS server_service_winbind_init(void)
{
- return register_server_service("winbind", winbind_init);
+ return register_server_service("winbind", winbind_task_init);
}