r26672: Janitorial: Remove uses of global_loadparm.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 6 Jan 2008 01:03:43 +0000 (19:03 -0600)
committerStefan Metzmacher <metze@samba.org>
Sat, 5 Jan 2008 19:06:03 +0000 (13:06 -0600)
(This used to be commit 18cd08623eaad7d2cd63b82ea5275d4dfd21cf00)

23 files changed:
source4/cldap_server/cldap_server.c
source4/dsdb/repl/drepl_service.c
source4/kdc/kdc.c
source4/ldap_server/ldap_server.c
source4/nbt_server/nbt_server.c
source4/ntvfs/ipc/ipc_rap.c
source4/ntvfs/ipc/rap_server.c
source4/ntvfs/ipc/vfs_ipc.c
source4/ntvfs/sysdep/sys_notify.c
source4/rpc_server/service_rpc.c
source4/smb_server/smb2/fileio.c
source4/smb_server/smb_server.c
source4/smbd/process_model.h
source4/smbd/process_single.c
source4/smbd/process_standard.c
source4/smbd/process_thread.c
source4/smbd/service_stream.c
source4/smbd/service_task.c
source4/torture/util_smb.c
source4/web_server/web_server.c
source4/winbind/wb_server.c
source4/wrepl_server/wrepl_in_connection.c
source4/wrepl_server/wrepl_server.c

index 47597ff1dbf80ece9972093218cc7db9368d1e23..d68637104db3b5eea582e7d9053dbd8e7dacb78a 100644 (file)
@@ -209,7 +209,7 @@ static void cldapd_task_init(struct task_server *task)
  */
 static NTSTATUS cldapd_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops)
 {
-       return task_server_startup(event_ctx, model_ops, cldapd_task_init);
+       return task_server_startup(event_ctx, lp_ctx, model_ops, cldapd_task_init);
 }
 
 
index c3238a206f26ef4af1232eda58591eccafa002e2..e212407e2406483920b15bee9b6a8b9cdddf9a2e 100644 (file)
@@ -185,7 +185,7 @@ static void dreplsrv_task_init(struct task_server *task)
  */
 static NTSTATUS dreplsrv_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops)
 {
-       return task_server_startup(event_ctx, model_ops, dreplsrv_task_init);
+       return task_server_startup(event_ctx, lp_ctx, model_ops, dreplsrv_task_init);
 }
 
 /*
index 5c8b2afe0fceb24fca340c45ad1fb2a00eb9c526..04e7ddd2ff1ceef58087fdb89f9333936366c76f 100644 (file)
@@ -489,7 +489,9 @@ static NTSTATUS kdc_add_socket(struct kdc_server *kdc, const char *address,
                return NT_STATUS_INTERNAL_ERROR;
        }
 
-       status = stream_setup_socket(kdc->task->event_ctx, model_ops, 
+       status = stream_setup_socket(kdc->task->event_ctx, 
+                                    kdc->task->lp_ctx,
+                                    model_ops, 
                                     &kdc_tcp_stream_ops, 
                                     "ip", address, &kdc_port, 
                                     lp_socket_options(kdc->task->lp_ctx), 
@@ -501,7 +503,9 @@ static NTSTATUS kdc_add_socket(struct kdc_server *kdc, const char *address,
                return status;
        }
 
-       status = stream_setup_socket(kdc->task->event_ctx, model_ops, 
+       status = stream_setup_socket(kdc->task->event_ctx, 
+                                    kdc->task->lp_ctx,
+                                    model_ops, 
                                     &kpasswdd_tcp_stream_ops, 
                                     "ip", address, &kpasswd_port, 
                                     lp_socket_options(kdc->task->lp_ctx), 
@@ -663,7 +667,7 @@ static NTSTATUS kdc_init(struct event_context *event_ctx,
                         struct loadparm_context *lp_ctx,
                         const struct model_ops *model_ops)
 {      
-       return task_server_startup(event_ctx, model_ops, kdc_task_init);
+       return task_server_startup(event_ctx, lp_ctx, model_ops, kdc_task_init);
 }
 
 /* called at smbd startup - register ourselves as a server service */
index c7b1099166eacfe2c79ce99ebd8842edb539e8f1..fcc9435ead11a0ab65eb11b0879a261db754a5b2 100644 (file)
@@ -449,7 +449,8 @@ static NTSTATUS add_socket(struct event_context *event_context,
        NTSTATUS status;
        struct ldb_context *ldb;
 
-       status = stream_setup_socket(event_context, model_ops, &ldap_stream_ops, 
+       status = stream_setup_socket(event_context, lp_ctx,
+                                    model_ops, &ldap_stream_ops, 
                                     "ipv4", address, &port, 
                                     lp_socket_options(lp_ctx), 
                                     ldap_service);
@@ -461,7 +462,8 @@ static NTSTATUS add_socket(struct event_context *event_context,
        if (tls_support(ldap_service->tls_params)) {
                /* add ldaps server */
                port = 636;
-               status = stream_setup_socket(event_context, model_ops, &ldap_stream_ops, 
+               status = stream_setup_socket(event_context, lp_ctx, 
+                                            model_ops, &ldap_stream_ops, 
                                             "ipv4", address, &port, 
                                             lp_socket_options(lp_ctx), 
                                             ldap_service);
@@ -479,7 +481,8 @@ static NTSTATUS add_socket(struct event_context *event_context,
        
        if (samdb_is_gc(ldb)) {
                port = 3268;
-               status = stream_setup_socket(event_context, model_ops, &ldap_stream_ops, 
+               status = stream_setup_socket(event_context, lp_ctx,
+                                            model_ops, &ldap_stream_ops, 
                                             "ipv4", address, &port, 
                                             lp_socket_options(lp_ctx), 
                                             ldap_service);
@@ -556,7 +559,8 @@ static void ldapsrv_task_init(struct task_server *task)
                goto failed;
        }
 
-       status = stream_setup_socket(task->event_ctx, model_ops, &ldap_stream_ops, 
+       status = stream_setup_socket(task->event_ctx, task->lp_ctx,
+                                    model_ops, &ldap_stream_ops, 
                                     "unix", ldapi_path, NULL, 
                                     lp_socket_options(task->lp_ctx), 
                                     ldap_service);
@@ -580,7 +584,8 @@ static NTSTATUS ldapsrv_init(struct event_context *event_context,
                             struct loadparm_context *lp_ctx,
                             const struct model_ops *model_ops)
 {      
-       return task_server_startup(event_context, model_ops, ldapsrv_task_init);
+       return task_server_startup(event_context, lp_ctx, model_ops, 
+                                  ldapsrv_task_init);
 }
 
 
index c7fb3b286a447ba12a805fe86b70b06c0588a42a..1718ef7f2e0e1788b0fc6bbf94453b4e96f557eb 100644 (file)
@@ -93,7 +93,8 @@ static void nbtd_task_init(struct task_server *task)
  */
 static NTSTATUS nbtd_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops)
 {
-       return task_server_startup(event_ctx, model_ops, nbtd_task_init);
+       return task_server_startup(event_ctx, lp_ctx, 
+                                  model_ops, nbtd_task_init);
 }
 
 
index 85bc5c212f7253959956c11d6dc9ad06e3dd9aa5..faf48705c466cc27630c809fe755de68e33939f5 100644 (file)
@@ -82,6 +82,8 @@ static void rap_heap_restore(struct rap_string_heap *heap,
 }
 
 struct rap_call {
+       struct loadparm_context *lp_ctx;
+
        TALLOC_CTX *mem_ctx;
        uint16_t callno;
        const char *paramdesc;
@@ -103,6 +105,7 @@ struct rap_call {
 #define RAPNDR_FLAGS (LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
 
 static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx,
+                                        struct loadparm_context *lp_ctx,
                                         struct smb_trans2 *trans)
 {
        struct rap_call *call;
@@ -114,12 +117,14 @@ static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx,
 
        ZERO_STRUCTP(call);
 
+       call->lp_ctx = talloc_reference(call, lp_ctx);
+
        call->mem_ctx = mem_ctx;
 
-       call->ndr_pull_param = ndr_pull_init_blob(&trans->in.params, mem_ctx, lp_iconv_convenience(global_loadparm));
+       call->ndr_pull_param = ndr_pull_init_blob(&trans->in.params, mem_ctx, lp_iconv_convenience(lp_ctx));
        call->ndr_pull_param->flags = RAPNDR_FLAGS;
 
-       call->ndr_pull_data = ndr_pull_init_blob(&trans->in.data, mem_ctx, lp_iconv_convenience(global_loadparm));
+       call->ndr_pull_data = ndr_pull_init_blob(&trans->in.data, mem_ctx, lp_iconv_convenience(lp_ctx));
        call->ndr_pull_data->flags = RAPNDR_FLAGS;
 
        call->heap = talloc(mem_ctx, struct rap_string_heap);
@@ -266,7 +271,7 @@ static NTSTATUS _rap_netshareenum(struct rap_call *call)
                break;
        }
 
-       result = rap_netshareenum(call, &r);
+       result = rap_netshareenum(call, call->lp_ctx, &r);
 
        if (!NT_STATUS_IS_OK(result))
                return result;
@@ -348,7 +353,7 @@ static NTSTATUS _rap_netserverenum2(struct rap_call *call)
                break;
        }
 
-       result = rap_netserverenum2(call, &r);
+       result = rap_netserverenum2(call, call->lp_ctx, &r);
 
        if (!NT_STATUS_IS_OK(result))
                return result;
@@ -425,7 +430,8 @@ static const struct
        {NULL, -1, api_Unsupported}
 };
 
-NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans)
+NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
+                     struct smb_trans2 *trans)
 {
        int i;
        NTSTATUS result;
@@ -434,7 +440,7 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans)
        struct ndr_push *final_param;
        struct ndr_push *final_data;
 
-       call = new_rap_srv_call(mem_ctx, trans);
+       call = new_rap_srv_call(mem_ctx, lp_ctx, trans);
 
        if (call == NULL)
                return NT_STATUS_NO_MEMORY;
@@ -445,8 +451,8 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans)
        NDR_RETURN(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS,
                                  &call->datadesc));
 
-       call->ndr_push_param = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
-       call->ndr_push_data = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
+       call->ndr_push_param = ndr_push_init_ctx(call, lp_iconv_convenience(lp_ctx));
+       call->ndr_push_data = ndr_push_init_ctx(call, lp_iconv_convenience(lp_ctx));
 
        if ((call->ndr_push_param == NULL) || (call->ndr_push_data == NULL))
                return NT_STATUS_NO_MEMORY;
@@ -471,8 +477,8 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans)
        result_param = ndr_push_blob(call->ndr_push_param);
        result_data = ndr_push_blob(call->ndr_push_data);
 
-       final_param = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
-       final_data = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
+       final_param = ndr_push_init_ctx(call, lp_iconv_convenience(lp_ctx));
+       final_data = ndr_push_init_ctx(call, lp_iconv_convenience(lp_ctx));
 
        if ((final_param == NULL) || (final_data == NULL))
                return NT_STATUS_NO_MEMORY;
index 7d3020a2590c86c61bcd4904a042230c1f712aa8..633f0bf36e3abb7d27a14db55da2fa2bd0204712 100644 (file)
@@ -29,6 +29,7 @@
  * idea. */
 
 NTSTATUS rap_netshareenum(TALLOC_CTX *mem_ctx,
+                         struct loadparm_context *lp_ctx,
                          struct rap_NetShareEnum *r)
 {
        NTSTATUS nterr;
@@ -41,7 +42,7 @@ NTSTATUS rap_netshareenum(TALLOC_CTX *mem_ctx,
        r->out.available = 0;
        r->out.info = NULL;
 
-       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(global_loadparm), global_loadparm, &sctx);
+       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(lp_ctx), lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(nterr)) {
                return nterr;
        }
@@ -75,6 +76,7 @@ NTSTATUS rap_netshareenum(TALLOC_CTX *mem_ctx,
 }
 
 NTSTATUS rap_netserverenum2(TALLOC_CTX *mem_ctx,
+                           struct loadparm_context *lp_ctx,
                            struct rap_NetServerEnum2 *r)
 {
        r->out.status = 0;
index b69fb98c5d60a3b5db6a721a602586ab29346edf..81cd984f0b5e9230b6a8eff4edc34e631a7c3b9b 100644 (file)
@@ -805,7 +805,7 @@ static NTSTATUS ipc_trans(struct ntvfs_module_context *ntvfs,
        NTSTATUS status;
 
        if (strequal(trans->in.trans_name, "\\PIPE\\LANMAN"))
-               return ipc_rap_call(req, trans);
+               return ipc_rap_call(req, ntvfs->ctx->lp_ctx, trans);
 
                if (trans->in.setup_count != 2) {
                return NT_STATUS_INVALID_PARAMETER;
index 2ed9908af7c4d23cd7aae754d748b3b1c330c797..84ba745f5be15c3e4736ae59207c484671c37364 100644 (file)
@@ -126,17 +126,11 @@ _PUBLIC_ NTSTATUS sys_notify_init(void)
        static bool initialized = false;
 
        init_module_fn static_init[] = { STATIC_sys_notify_MODULES };
-       init_module_fn *shared_init;
 
        if (initialized) return NT_STATUS_OK;
        initialized = true;
 
-       shared_init = load_samba_modules(NULL, global_loadparm, "sys_notify");
-
        run_init_functions(static_init);
-       run_init_functions(shared_init);
-
-       talloc_free(shared_init);
        
        return NT_STATUS_OK;
 }
index 46b869ad7123b38bfa69f52e2c1dc67d15d04cfc..46916135f9a4799e6f53739910657eb791ae0869 100644 (file)
@@ -232,7 +232,8 @@ static NTSTATUS dcesrv_add_ep_unix(struct dcesrv_context *dce_ctx,
        dcesrv_sock->endpoint           = e;
        dcesrv_sock->dcesrv_ctx         = talloc_reference(dcesrv_sock, dce_ctx);
 
-       status = stream_setup_socket(event_ctx, model_ops, &dcesrv_stream_ops, 
+       status = stream_setup_socket(event_ctx, lp_ctx,
+                                    model_ops, &dcesrv_stream_ops, 
                                     "unix", e->ep_description->endpoint, &port, 
                                     lp_socket_options(lp_ctx), 
                                     dcesrv_sock);
@@ -271,7 +272,8 @@ static NTSTATUS dcesrv_add_ep_ncalrpc(struct dcesrv_context *dce_ctx,
        dcesrv_sock->endpoint           = e;
        dcesrv_sock->dcesrv_ctx         = talloc_reference(dcesrv_sock, dce_ctx);
 
-       status = stream_setup_socket(event_ctx, model_ops, &dcesrv_stream_ops, 
+       status = stream_setup_socket(event_ctx, lp_ctx,
+                                    model_ops, &dcesrv_stream_ops, 
                                     "unix", full_path, &port, 
                                     lp_socket_options(lp_ctx), 
                                     dcesrv_sock);
@@ -352,7 +354,8 @@ static NTSTATUS add_socket_rpc_tcp_iface(struct dcesrv_context *dce_ctx, struct
        dcesrv_sock->endpoint           = e;
        dcesrv_sock->dcesrv_ctx         = talloc_reference(dcesrv_sock, dce_ctx);
 
-       status = stream_setup_socket(event_ctx, model_ops, &dcesrv_stream_ops, 
+       status = stream_setup_socket(event_ctx, dce_ctx->lp_ctx,
+                                    model_ops, &dcesrv_stream_ops, 
                                     "ipv4", address, &port, 
                                     lp_socket_options(dce_ctx->lp_ctx), 
                                     dcesrv_sock);
@@ -462,7 +465,8 @@ static NTSTATUS dcesrv_init(struct event_context *event_context,
                            struct loadparm_context *lp_ctx,
                            const struct model_ops *model_ops)
 {      
-       return task_server_startup(event_context, model_ops, dcesrv_task_init);
+       return task_server_startup(event_context, lp_ctx, 
+                                  model_ops, dcesrv_task_init);
 }
 
 NTSTATUS server_service_rpc_init(void)
index e853743b2f6612f349ae916b63b6fa90a3092b45..0e83c786152103becaa22f85fe1625e159fdd387 100644 (file)
@@ -353,7 +353,7 @@ static void smb2srv_notify_send(struct ntvfs_request *ntvfs)
                ssize_t len;
 
                SIVAL(p, 4, io->smb2.out.changes[i].action);
-               len = push_string(lp_iconv_convenience(global_loadparm), p + 12, io->smb2.out.changes[i].name.s, 
+               len = push_string(lp_iconv_convenience(ntvfs->ctx->lp_ctx), p + 12, io->smb2.out.changes[i].name.s, 
                                  blob.length - (p+12 - blob.data), STR_UNICODE);
                SIVAL(p, 8, len);
 
index 082de6540b28bf0f08364ed3c3e0341946878501..cbff585e21af8b91bf45f0567d95b262093a7d57 100644 (file)
@@ -185,7 +185,8 @@ _PUBLIC_ NTSTATUS smbsrv_add_socket(struct event_context *event_context,
        for (i=0;ports[i];i++) {
                uint16_t port = atoi(ports[i]);
                if (port == 0) continue;
-               status = stream_setup_socket(event_context, model_ops, &smb_stream_ops, 
+               status = stream_setup_socket(event_context, lp_ctx, 
+                                            model_ops, &smb_stream_ops, 
                                             "ipv4", address, &port, 
                                             lp_socket_options(lp_ctx), 
                                             NULL);
@@ -257,7 +258,8 @@ static NTSTATUS smbsrv_init(struct event_context *event_context,
                            struct loadparm_context *lp_ctx,
                            const struct model_ops *model_ops)
 {      
-       return task_server_startup(event_context, model_ops, smbsrv_task_init);
+       return task_server_startup(event_context, lp_ctx, 
+                                  model_ops, smbsrv_task_init);
 }
 
 /* called at smbd startup - register ourselves as a server service */
index 19212606c1c1bb47427197b9db9c102c095b14c2..c2a5c9e9e89850ea39d1dd90a0a8cf9159dad514 100644 (file)
@@ -44,14 +44,21 @@ struct model_ops {
        void (*model_init)(struct event_context *);
 
        /* function to accept new connection */
-       void (*accept_connection)(struct event_context *, struct socket_context *, 
-                                 void (*)(struct event_context *, struct socket_context *, 
+       void (*accept_connection)(struct event_context *, 
+                                 struct loadparm_context *,
+                                 struct socket_context *, 
+                                 void (*)(struct event_context *, 
+                                          struct loadparm_context *,
+                                          struct socket_context *, 
                                           struct server_id , void *), 
                                  void *);
 
        /* function to create a task */
        void (*new_task)(struct event_context *, 
-                        void (*)(struct event_context *, struct server_id, void *),
+                        struct loadparm_context *lp_ctx, 
+                        void (*)(struct event_context *, 
+                                 struct loadparm_context *, struct server_id, 
+                                 void *),
                         void *);
 
        /* function to terminate a connection or task */
index 5ba2c8df887239b40d17b0651fe442688a6b9f11..5d3c36adb9faf67cc5364898513eb90f3cc4da5a 100644 (file)
@@ -37,8 +37,11 @@ static void single_model_init(struct event_context *ev)
   called when a listening socket becomes readable. 
 */
 static void single_accept_connection(struct event_context *ev, 
+                                    struct loadparm_context *lp_ctx,
                                     struct socket_context *sock,
-                                    void (*new_conn)(struct event_context *, struct socket_context *, 
+                                    void (*new_conn)(struct event_context *, 
+                                                     struct loadparm_context *,
+                                                     struct socket_context *, 
                                                      struct server_id , void *), 
                                     void *private)
 {
@@ -61,18 +64,19 @@ static void single_accept_connection(struct event_context *ev,
 
        talloc_steal(private, sock);
 
-       new_conn(ev, sock2, cluster_id(socket_get_fd(sock2)), private);
+       new_conn(ev, lp_ctx, sock2, cluster_id(socket_get_fd(sock2)), private);
 }
 
 /*
   called to startup a new task
 */
 static void single_new_task(struct event_context *ev, 
-                           void (*new_task)(struct event_context *, struct server_id, void *), 
+                           struct loadparm_context *lp_ctx, 
+                           void (*new_task)(struct event_context *, struct loadparm_context *, struct server_id, void *), 
                            void *private)
 {
        static uint32_t taskid = 0x10000000;
-       new_task(ev, cluster_id(taskid++), private);
+       new_task(ev, lp_ctx, cluster_id(taskid++), private);
 }
 
 
index 09d32d05aa39d7716d3ee0ef2ebb7338e0cc0e87..c088ea3b1a3a5b9c29b9cb1ff731c8ee3b6c3561 100644 (file)
@@ -56,8 +56,10 @@ static void standard_model_init(struct event_context *ev)
   called when a listening socket becomes readable. 
 */
 static void standard_accept_connection(struct event_context *ev, 
+                                      struct loadparm_context *lp_ctx,
                                       struct socket_context *sock, 
-                                      void (*new_conn)(struct event_context *, struct socket_context *, 
+                                      void (*new_conn)(struct event_context *,
+                                                       struct loadparm_context *, struct socket_context *, 
                                                        struct server_id , void *), 
                                       void *private)
 {
@@ -126,7 +128,7 @@ static void standard_accept_connection(struct event_context *ev,
        talloc_free(s);
 
        /* setup this new connection */
-       new_conn(ev2, sock2, cluster_id(pid), private);
+       new_conn(ev2, lp_ctx, sock2, cluster_id(pid), private);
 
        /* we can't return to the top level here, as that event context is gone,
           so we now process events in the new event context until there are no
@@ -141,7 +143,8 @@ static void standard_accept_connection(struct event_context *ev,
   called to create a new server task
 */
 static void standard_new_task(struct event_context *ev, 
-                             void (*new_task)(struct event_context *, struct server_id , void *), 
+                             struct loadparm_context *lp_ctx,
+                             void (*new_task)(struct event_context *, struct loadparm_context *lp_ctx, struct server_id , void *), 
                              void *private)
 {
        pid_t pid;
@@ -179,7 +182,7 @@ static void standard_new_task(struct event_context *ev,
        setproctitle("task server_id[%d]", pid);
 
        /* setup this new connection */
-       new_task(ev2, cluster_id(pid), private);
+       new_task(ev2, lp_ctx, cluster_id(pid), private);
 
        /* we can't return to the top level here, as that event context is gone,
           so we now process events in the new event context until there are no
index 349ed44bc9cf47944a7e7ec04441cb11169aed47..6c5f4816c02defd2d41bd2eb182f466588ce7860 100644 (file)
@@ -39,7 +39,8 @@ static pthread_key_t title_key;
 struct new_conn_state {
        struct event_context *ev;
        struct socket_context *sock;
-       void (*new_conn)(struct event_context *, struct socket_context *, uint32_t , void *);
+       struct loadparm_context *lp_ctx;
+       void (*new_conn)(struct event_context *, struct loadparm_context *lp_ctx, struct socket_context *, uint32_t , void *);
        void *private;
 };
 
@@ -47,7 +48,7 @@ static void *thread_connection_fn(void *thread_parm)
 {
        struct new_conn_state *new_conn = talloc_get_type(thread_parm, struct new_conn_state);
 
-       new_conn->new_conn(new_conn->ev, new_conn->sock, pthread_self(), new_conn->private);
+       new_conn->new_conn(new_conn->ev, new_conn->lp_ctx, new_conn->sock, pthread_self(), new_conn->private);
 
        /* run this connection from here */
        event_loop_wait(new_conn->ev);
@@ -61,8 +62,11 @@ static void *thread_connection_fn(void *thread_parm)
   called when a listening socket becomes readable
 */
 static void thread_accept_connection(struct event_context *ev, 
+                                    struct loadparm_context *lp_ctx, 
                                     struct socket_context *sock,
-                                    void (*new_conn)(struct event_context *, struct socket_context *, 
+                                    void (*new_conn)(struct event_context *, 
+                                                     struct loadparm_context *,
+                                                     struct socket_context *, 
                                                      uint32_t , void *), 
                                     void *private)
 {              
@@ -84,6 +88,7 @@ static void thread_accept_connection(struct event_context *ev,
 
        state->new_conn = new_conn;
        state->private  = private;
+       state->lp_ctx   = lp_ctx;
        state->ev       = ev2;
 
        /* accept an incoming connection. */
@@ -117,7 +122,9 @@ static void thread_accept_connection(struct event_context *ev,
 
 struct new_task_state {
        struct event_context *ev;
-       void (*new_task)(struct event_context *, uint32_t , void *);
+       struct loadparm_context *lp_ctx;
+       void (*new_task)(struct event_context *, struct loadparm_context *, 
+                        uint32_t , void *);
        void *private;
 };
 
@@ -125,7 +132,8 @@ static void *thread_task_fn(void *thread_parm)
 {
        struct new_task_state *new_task = talloc_get_type(thread_parm, struct new_task_state);
 
-       new_task->new_task(new_task->ev, pthread_self(), new_task->private);
+       new_task->new_task(new_task->ev, new_task->lp_ctx, pthread_self(), 
+                          new_task->private);
 
        /* run this connection from here */
        event_loop_wait(new_task->ev);
@@ -139,7 +147,10 @@ static void *thread_task_fn(void *thread_parm)
   called when a new task is needed
 */
 static void thread_new_task(struct event_context *ev, 
-                           void (*new_task)(struct event_context *, uint32_t , void *), 
+                           struct loadparm_context *lp_ctx,
+                           void (*new_task)(struct event_context *, 
+                                            struct loadparm_context *,
+                                            uint32_t , void *), 
                            void *private)
 {              
        int rc;
@@ -158,6 +169,7 @@ static void thread_new_task(struct event_context *ev,
        }
 
        state->new_task = new_task;
+       state->lp_ctx   = lp_ctx;
        state->private  = private;
        state->ev       = ev2;
 
index 6d2e95dc94e3f8fad8bbc44344b70def1a7bdf9a..0d6f1b72817db810e69627eb5a6cd6457e7f50ba 100644 (file)
@@ -43,6 +43,7 @@
 */
 struct stream_socket {
        const struct stream_server_ops *ops;
+       struct loadparm_context *lp_ctx;
        struct event_context *event_ctx;
        const struct model_ops *model_ops;
        struct socket_context *sock;
@@ -151,6 +152,7 @@ NTSTATUS stream_new_connection_merge(struct event_context *ev,
   context of the new process (if appropriate)
 */
 static void stream_new_connection(struct event_context *ev,
+                                 struct loadparm_context *lp_ctx,
                                  struct socket_context *sock, 
                                  struct server_id server_id, void *private)
 {
@@ -182,9 +184,9 @@ static void stream_new_connection(struct event_context *ev,
 
        /* setup to receive internal messages on this connection */
        srv_conn->msg_ctx = messaging_init(srv_conn, 
-                                          lp_messaging_path(srv_conn, global_loadparm),
+                                          lp_messaging_path(srv_conn, lp_ctx),
                                           srv_conn->server_id, 
-                                          lp_iconv_convenience(global_loadparm),
+                                          lp_iconv_convenience(lp_ctx),
                                           ev);
        if (!srv_conn->msg_ctx) {
                stream_terminate_connection(srv_conn, "messaging_init() failed");
@@ -225,7 +227,8 @@ static void stream_accept_handler(struct event_context *ev, struct fd_event *fde
        /* ask the process model to create us a process for this new
           connection.  When done, it calls stream_new_connection()
           with the newly created socket */
-       stream_socket->model_ops->accept_connection(ev, stream_socket->sock, 
+       stream_socket->model_ops->accept_connection(ev, stream_socket->lp_ctx, 
+                                                   stream_socket->sock, 
                                                    stream_new_connection, stream_socket);
 }
 
@@ -238,6 +241,7 @@ static void stream_accept_handler(struct event_context *ev, struct fd_event *fde
          to the socket implementation - JRV20070903
  */
 NTSTATUS stream_setup_socket(struct event_context *event_context,
+                            struct loadparm_context *lp_ctx,
                             const struct model_ops *model_ops,
                             const struct stream_server_ops *stream_ops,
                             const char *family,
@@ -259,6 +263,8 @@ NTSTATUS stream_setup_socket(struct event_context *event_context,
 
        talloc_steal(stream_socket, stream_socket->sock);
 
+       stream_socket->lp_ctx = talloc_reference(stream_socket, lp_ctx);
+
        /* ready to listen */
        status = socket_set_option(stream_socket->sock, "SO_KEEPALIVE", NULL);
        NT_STATUS_NOT_OK_RETURN(status);
index f286da5cf6dc7b773433e83285d0f6d41b9a0420..08588464cc8343398fbef4fbf349c411e390131b 100644 (file)
@@ -53,6 +53,7 @@ struct task_state {
   the server specific startup code
 */
 static void task_server_callback(struct event_context *event_ctx, 
+                                struct loadparm_context *lp_ctx,
                                 struct server_id server_id, void *private)
 {
        struct task_state *state = talloc_get_type(private, struct task_state);
@@ -64,7 +65,7 @@ static void task_server_callback(struct event_context *event_ctx,
        task->event_ctx = event_ctx;
        task->model_ops = state->model_ops;
        task->server_id = server_id;
-       task->lp_ctx = global_loadparm;
+       task->lp_ctx = lp_ctx;
 
        task->msg_ctx = messaging_init(task, 
                                       lp_messaging_path(task, task->lp_ctx),
@@ -83,6 +84,7 @@ static void task_server_callback(struct event_context *event_ctx,
   startup a task based server
 */
 NTSTATUS task_server_startup(struct event_context *event_ctx, 
+                            struct loadparm_context *lp_ctx,
                             const struct model_ops *model_ops, 
                             void (*task_init)(struct task_server *))
 {
@@ -94,7 +96,7 @@ NTSTATUS task_server_startup(struct event_context *event_ctx,
        state->task_init = task_init;
        state->model_ops = model_ops;
        
-       model_ops->new_task(event_ctx, task_server_callback, state);
+       model_ops->new_task(event_ctx, lp_ctx, task_server_callback, state);
 
        return NT_STATUS_OK;
 }
index 6621b68b6e91dab46cccbb092361077fc3fc7d11..de7303bac8b3241d1184d2e8e62c283fc2fb618b 100644 (file)
@@ -294,7 +294,7 @@ bool wire_bad_flags(struct smb_wire_string *str, int flags,
        if (flags & STR_TERMINATE) len++;
 
        server_unicode = (transport->negotiate.capabilities&CAP_UNICODE)?true:false;
-       if (getenv("CLI_FORCE_ASCII") || !lp_unicode(global_loadparm)) {
+       if (getenv("CLI_FORCE_ASCII") || !transport->options.unicode) {
                server_unicode = false;
        }
 
index 87cab2cc92496b7bb60f4845437434725fb2afe9..9ff67f78f30da7458ee44af090b91d2154af3e0a 100644 (file)
@@ -260,7 +260,8 @@ static void websrv_task_init(struct task_server *task)
                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, model_ops, 
+                       status = stream_setup_socket(task->event_ctx, 
+                                                    task->lp_ctx, model_ops, 
                                                     &web_stream_ops, 
                                                     "ipv4", address, 
                                                     &port, lp_socket_options(task->lp_ctx), 
@@ -270,8 +271,8 @@ static void websrv_task_init(struct task_server *task)
 
                talloc_free(ifaces);
        } else {
-               status = stream_setup_socket(task->event_ctx, model_ops, 
-                                            &web_stream_ops, 
+               status = stream_setup_socket(task->event_ctx, task->lp_ctx,
+                                            model_ops, &web_stream_ops, 
                                             "ipv4", lp_socket_address(task->lp_ctx), 
                                             &port, lp_socket_options(task->lp_ctx), task);
                if (!NT_STATUS_IS_OK(status)) goto failed;
@@ -297,7 +298,8 @@ static NTSTATUS websrv_init(struct event_context *event_context,
                            struct loadparm_context *lp_ctx,
                            const struct model_ops *model_ops)
 {      
-       return task_server_startup(event_context, model_ops, websrv_task_init);
+       return task_server_startup(event_context, lp_ctx, 
+                                  model_ops, websrv_task_init);
 }
 
 /* called at smbd startup - register ourselves as a server service */
index f27a3bd12d83099cc9d5a750865948207161a2f2..eaba6609f30cd5c825f8625bf490b06a5cdc40ef 100644 (file)
@@ -158,7 +158,7 @@ static void winbind_task_init(struct task_server *task)
        if (!listen_socket->socket_path) goto nomem;
        listen_socket->service          = service;
        listen_socket->privileged       = false;
-       status = stream_setup_socket(task->event_ctx, model_ops,
+       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), 
@@ -174,7 +174,7 @@ static void winbind_task_init(struct task_server *task)
        if (!listen_socket->socket_path) goto nomem;
        listen_socket->service          = service;
        listen_socket->privileged       = true;
-       status = stream_setup_socket(task->event_ctx, model_ops,
+       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), 
@@ -208,7 +208,8 @@ static NTSTATUS winbind_init(struct event_context *event_ctx,
                             struct loadparm_context *lp_ctx,
                             const struct model_ops *model_ops)
 {
-       return task_server_startup(event_ctx, model_ops, winbind_task_init);
+       return task_server_startup(event_ctx, lp_ctx, 
+                                  model_ops, winbind_task_init);
 }
 
 /*
index 721a00521338be73d75f48d8dde52096a3b2154b..34d94d73a6b9e5323e489a6cc4d55c344326d280 100644 (file)
@@ -294,7 +294,9 @@ NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service, struct loadpar
                */
                for(i = 0; i < num_interfaces; i++) {
                        address = iface_n_ip(ifaces, i);
-                       status = stream_setup_socket(task->event_ctx, model_ops, &wreplsrv_stream_ops,
+                       status = stream_setup_socket(task->event_ctx, 
+                                                    task->lp_ctx, model_ops, 
+                                                    &wreplsrv_stream_ops,
                                                     "ipv4", address, &port, 
                                                      lp_socket_options(task->lp_ctx), 
                                                     service);
@@ -306,7 +308,8 @@ NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service, struct loadpar
                }
        } else {
                address = lp_socket_address(lp_ctx);
-               status = stream_setup_socket(task->event_ctx, model_ops, &wreplsrv_stream_ops,
+               status = stream_setup_socket(task->event_ctx, task->lp_ctx, 
+                                            model_ops, &wreplsrv_stream_ops,
                                             "ipv4", address, &port, lp_socket_options(task->lp_ctx), 
                                             service);
                if (!NT_STATUS_IS_OK(status)) {
index 7d4be3e1b5171657b06e49cbb5f967842cd66ff2..50ef7e8550d8c7c2d86345f0393560f6f21499d6 100644 (file)
@@ -510,7 +510,8 @@ static NTSTATUS wreplsrv_init(struct event_context *event_ctx, struct loadparm_c
                return NT_STATUS_OK;
        }
 
-       return task_server_startup(event_ctx, model_ops, wreplsrv_task_init);
+       return task_server_startup(event_ctx, lp_ctx, 
+                                  model_ops, wreplsrv_task_init);
 }
 
 /*