Fix include paths to new location of libutil.
[bbaumbach/samba-autobuild/.git] / source4 / winbind / wb_server.c
index f84dece11c0feb3190950f630949c94f80ede9d4..b8309597d7b89c38f474aa0a90a7fd8e6679bf24 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "includes.h"
 #include "lib/socket/socket.h"
-#include "lib/util/dlinklist.h"
+#include "../lib/util/dlinklist.h"
 #include "lib/events/events.h"
 #include "smbd/service_task.h"
 #include "smbd/process_model.h"
@@ -122,7 +122,7 @@ static void winbind_task_init(struct task_server *task)
        /* within the winbind 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_byname("single");
+       model_ops = process_model_startup(task->event_ctx, "single");
        if (!model_ops) {
                task_server_terminate(task,
                                      "Can't find 'single' process model_ops");
@@ -136,11 +136,19 @@ static void winbind_task_init(struct task_server *task)
                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,
+                                                     task->event_ctx,
                                                      task->lp_ctx,
                                                      lp_workgroup(task->lp_ctx));
        if (service->primary_sid == NULL) {
@@ -174,9 +182,12 @@ static void winbind_task_init(struct task_server *task)
        /* 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, task->lp_ctx, 
-                             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;