r26230: Use task-provided loadparm context in a couple more places, avoid loadparm...
authorJelmer Vernooij <jelmer@samba.org>
Sun, 2 Dec 2007 18:27:49 +0000 (19:27 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:47:07 +0000 (05:47 +0100)
source/utils/ntlm_auth.c
source/winbind/wb_server.c
source/wrepl_server/wrepl_in_connection.c
source/wrepl_server/wrepl_server.c

index bb9b5d89faff9f27f7217a7ffd2d13ff42217019..20673775a57e01794f7e59571d573d7bd89d771f 100644 (file)
@@ -58,18 +58,22 @@ enum stdio_helper_mode {
 
 
 typedef void (*stdio_helper_function)(enum stdio_helper_mode stdio_helper_mode, 
+                                     struct loadparm_context *lp_ctx,
                                      char *buf, int length, void **private,
                                      unsigned int mux_id, void **private2);
 
 static void manage_squid_basic_request (enum stdio_helper_mode stdio_helper_mode, 
+                                       struct loadparm_context *lp_ctx,
                                        char *buf, int length, void **private,
                                        unsigned int mux_id, void **private2);
 
 static void manage_gensec_request (enum stdio_helper_mode stdio_helper_mode, 
+                                  struct loadparm_context *lp_ctx,
                                   char *buf, int length, void **private,
                                   unsigned int mux_id, void **private2);
 
 static void manage_ntlm_server_1_request (enum stdio_helper_mode stdio_helper_mode, 
+                                         struct loadparm_context *lp_ctx,
                                          char *buf, int length, void **private,
                                          unsigned int mux_id, void **private2);
 
@@ -241,6 +245,7 @@ static NTSTATUS local_pw_check_specified(struct loadparm_context *lp_ctx,
 }
 
 static void manage_squid_basic_request(enum stdio_helper_mode stdio_helper_mode, 
+                                      struct loadparm_context *lp_ctx,
                                       char *buf, int length, void **private,
                                       unsigned int mux_id, void **private2) 
 {
@@ -272,6 +277,7 @@ static void manage_squid_basic_request(enum stdio_helper_mode stdio_helper_mode,
    to the calling application.  The callback comes from within gensec */
 
 static void manage_gensec_get_pw_request(enum stdio_helper_mode stdio_helper_mode, 
+                                        struct loadparm_context *lp_ctx,
                                         char *buf, int length, void **private,
                                         unsigned int mux_id, void **password)  
 {
@@ -362,6 +368,7 @@ static void gensec_want_feature_list(struct gensec_security *state, char* featur
 }
 
 static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, 
+                                 struct loadparm_context *lp_ctx,
                                  char *buf, int length, void **private,
                                  unsigned int mux_id, void **private2) 
 {
@@ -692,6 +699,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
 }
 
 static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mode, 
+                                        struct loadparm_context *lp_ctx,
                                         char *buf, int length, void **private,
                                         unsigned int mux_id, void **private2) 
 {
@@ -712,7 +720,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod
                } else if (plaintext_password) {
                        /* handle this request as plaintext */
                        if (!full_username) {
-                               if (asprintf(&full_username, "%s%c%s", domain, *lp_winbind_separator(global_loadparm), username) == -1) {
+                               if (asprintf(&full_username, "%s%c%s", domain, *lp_winbind_separator(lp_ctx), username) == -1) {
                                        mux_printf(mux_id, "Error: Out of memory in asprintf!\n.\n");
                                        return;
                                }
@@ -747,7 +755,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod
                        }
 
                        if (!domain) {
-                               domain = smb_xstrdup(lp_workgroup(global_loadparm));
+                               domain = smb_xstrdup(lp_workgroup(lp_ctx));
                        }
 
                        if (ntlm_server_1_lm_session_key) 
@@ -757,10 +765,10 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod
                                flags |= NTLM_AUTH_FLAG_USER_SESSION_KEY;
 
                        if (!NT_STATUS_IS_OK(
-                                   local_pw_check_specified(global_loadparm,
+                                   local_pw_check_specified(lp_ctx,
                                                             username, 
                                                              domain, 
-                                                             lp_netbios_name(global_loadparm),
+                                                             lp_netbios_name(lp_ctx),
                                                              &challenge, 
                                                              &lm_response, 
                                                              &nt_response, 
@@ -991,7 +999,7 @@ static void manage_squid_request(enum stdio_helper_mode helper_mode,
                private = &normal_private;
        }
 
-       fn(helper_mode, c, length, private, mux_id, private2);
+       fn(helper_mode, global_loadparm, c, length, private, mux_id, private2);
        talloc_free(buf);
 }
 
index 6d002902d3046f30cec951db49b31858af1fa259..42252607740d9f8fc4e55834a44c9ddbfb7908a0 100644 (file)
@@ -129,7 +129,7 @@ static void winbind_task_init(struct task_server *task)
        }
 
        /* 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;
@@ -140,7 +140,7 @@ static void winbind_task_init(struct task_server *task)
        service->task   = task;
 
        service->primary_sid = secrets_get_domain_sid(service,
-                                                     lp_workgroup(global_loadparm));
+                                                     lp_workgroup(task->lp_ctx));
        if (service->primary_sid == NULL) {
                task_server_terminate(
                        task, nt_errstr(NT_STATUS_CANT_ACCESS_DOMAIN_INFO));
@@ -151,7 +151,7 @@ static void winbind_task_init(struct task_server *task)
        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;
@@ -166,7 +166,7 @@ static void winbind_task_init(struct task_server *task)
        listen_socket = talloc(service, struct wbsrv_listen_socket);
        if (!listen_socket) goto nomem;
        listen_socket->socket_path      =
-               smbd_tmp_path(listen_socket, global_loadparm
+               smbd_tmp_path(listen_socket, task->lp_ctx
                              WINBINDD_SAMBA3_PRIVILEGED_SOCKET);
        if (!listen_socket->socket_path) goto nomem;
        listen_socket->service          = service;
index d26c89d35d2efb7f8f5bed9ebecee559e46df6ec..65c8b6118f38389e6f1b3a24b704047b14f918ae 100644 (file)
@@ -258,7 +258,7 @@ NTSTATUS wreplsrv_in_connection_merge(struct wreplsrv_partner *partner,
 /*
   startup the wrepl port 42 server sockets
 */
-NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service)
+NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service, struct loadparm_context *lp_ctx)
 {
        NTSTATUS status;
        struct task_server *task = service->task;
@@ -275,7 +275,7 @@ NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service)
                return NT_STATUS_INTERNAL_ERROR;
        }
 
-       if (lp_interfaces(global_loadparm) && lp_bind_interfaces_only(global_loadparm)) {
+       if (lp_interfaces(lp_ctx) && lp_bind_interfaces_only(lp_ctx)) {
                int num_interfaces = iface_count();
                int i;
 
@@ -294,7 +294,7 @@ NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service)
                        }
                }
        } else {
-               address = lp_socket_address(global_loadparm);
+               address = lp_socket_address(lp_ctx);
                status = stream_setup_socket(task->event_ctx, model_ops, &wreplsrv_stream_ops,
                                             "ipv4", address, &port, service);
                if (!NT_STATUS_IS_OK(status)) {
index 91f0a4fb053124b5a5e1b9796c85fd0aab13f77d..a5c80072852650faa2ddf1dc22b22ce8aa6d5b4d 100644 (file)
@@ -477,7 +477,7 @@ static void wreplsrv_task_init(struct task_server *task)
         * setup listen sockets, so we can anwser requests from our partners,
         * which pull from us
         */
-       status = wreplsrv_setup_sockets(service);
+       status = wreplsrv_setup_sockets(service, task->lp_ctx);
        if (!NT_STATUS_IS_OK(status)) {
                task_server_terminate(task, "wreplsrv_task_init: wreplsrv_setup_sockets() failed");
                return;