r26236: Remove more uses of global_loadparm or specify loadparm_context explicitly.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 2 Dec 2007 21:32:11 +0000 (22:32 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:47:15 +0000 (05:47 +0100)
31 files changed:
source/auth/auth_server.c
source/auth/gensec/gensec_krb5.c
source/client/smbmount.c
source/lib/cmdline/popt_common.c
source/lib/registry/registry.h
source/lib/registry/registry.i
source/lib/registry/samba.c
source/lib/registry/tools/common.c
source/lib/registry/tools/regdiff.c
source/lib/registry/tools/regpatch.c
source/lib/registry/tools/regshell.c
source/lib/registry/tools/regtree.c
source/libcli/cliconnect.c
source/libcli/raw/rawnegotiate.c
source/libcli/smb_composite/connect.c
source/ntptr/ntptr.h
source/ntptr/ntptr_base.c
source/param/share.c
source/param/share.h
source/param/tests/share.c
source/rpc_server/winreg/rpc_winreg.c
source/scripting/ejs/smbcalls_reg.c
source/smb_server/smb/receive.c
source/smb_server/smb_server.c
source/smb_server/smb_server.h
source/smbd/pidfile.c
source/smbd/process_model.c
source/smbd/server.c
source/torture/basic/base.c
source/torture/rpc/wkssvc.c
source/utils/ntlm_auth.c

index d391793bd9a2a9f919e4f784765dbd54136c9a69..900ca8d05e91c2c7e985d050a84561f58f4145a6 100644 (file)
@@ -24,7 +24,7 @@
  Support for server level security.
 ****************************************************************************/
 
-static struct smbcli_state *server_cryptkey(TALLOC_CTX *mem_ctx, int maxprotocol)
+static struct smbcli_state *server_cryptkey(TALLOC_CTX *mem_ctx, bool unicode, int maxprotocol)
 {
        struct smbcli_state *cli = NULL;
        fstring desthost;
@@ -92,7 +92,7 @@ static struct smbcli_state *server_cryptkey(TALLOC_CTX *mem_ctx, int maxprotocol
        
        DEBUG(3,("got session\n"));
 
-       if (!smbcli_negprot(cli, maxprotocol)) {
+       if (!smbcli_negprot(cli, unicode, maxprotocol)) {
                DEBUG(1,("%s rejected the negprot\n",desthost));
                release_server_mutex();
                talloc_free(cli);
@@ -215,7 +215,7 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context
        
        if (cli) {
        } else {
-               cli = server_cryptkey(mem_ctx, lp_cli_maxprotocol(auth_context->lp_ctx));
+               cli = server_cryptkey(mem_ctx, lp_unicode(auth_context->lp_ctx), lp_cli_maxprotocol(auth_context->lp_ctx));
                locally_made_cli = true;
        }
 
index 1227a48ada0560a4bb98391ae21369d1f4317333..391d231f97ab7715499a75dbbfcc782f5bc7b0b1 100644 (file)
@@ -116,7 +116,7 @@ static NTSTATUS gensec_krb5_start(struct gensec_security *gensec_security)
 
        talloc_set_destructor(gensec_krb5_state, gensec_krb5_destroy); 
 
-       if (cli_credentials_get_krb5_context(creds, &gensec_krb5_state->smb_krb5_context)) {
+       if (cli_credentials_get_krb5_context(creds, global_loadparm, &gensec_krb5_state->smb_krb5_context)) {
                talloc_free(gensec_krb5_state);
                return NT_STATUS_INTERNAL_ERROR;
        }
index 1ac524dd0cbab20dee1c4990b4226d0a7f114aa3..34fb90fca676876b536cd2062d9936ba9241db37 100644 (file)
@@ -111,7 +111,7 @@ static void usr1_handler(int x)
 /***************************************************** 
 return a connection to a server
 *******************************************************/
-static struct smbcli_state *do_connection(char *the_service, int maxprotocol)
+static struct smbcli_state *do_connection(const char *the_service, bool unicode, int maxprotocol)
 {
        struct smbcli_state *c;
        struct nmb_name called, calling;
@@ -181,7 +181,7 @@ static struct smbcli_state *do_connection(char *the_service, int maxprotocol)
 
        DEBUG(4,("%d: session request ok\n", sys_getpid()));
 
-       if (!smbcli_negprot(c, maxprotocol)) {
+       if (!smbcli_negprot(c, unicode, maxprotocol)) {
                DEBUG(0,("%d: protocol negotiation failed\n", sys_getpid()));
                talloc_free(c);
                return NULL;
@@ -323,7 +323,7 @@ static void smb_umount(char *mount_point)
  * not exit after open_sockets() or send_login() errors,
  * as the smbfs mount would then have no way to recover.
  */
-static void send_fs_socket(char *the_service, char *mount_point, struct smbcli_state *c)
+static void send_fs_socket(const char *the_service, char *mount_point, struct smbcli_state *c)
 {
        int fd, closed = 0, res = 1;
        pid_t parentpid = getppid();
@@ -406,7 +406,7 @@ static void send_fs_socket(char *the_service, char *mount_point, struct smbcli_s
                        CatchSignal(SIGUSR1, &usr1_handler);
                        pause();
                        DEBUG(2,("mount.smbfs[%d]: got signal, getting new socket\n", sys_getpid()));
-                       c = do_connection(the_service);
+                       c = do_connection(the_service, lp_unicode(global_loadparm), lp_cli_maxprotocol(global_loadparm));
                }
        }
 
@@ -434,7 +434,7 @@ static void init_mount(void)
        }
 
 
-       c = do_connection(service, lp_cli_maxprotocol(global_loadparm));
+       c = do_connection(service, lp_unicode(global_loadparm), lp_cli_maxprotocol(global_loadparm));
        if (!c) {
                fprintf(stderr,"SMB connection failed\n");
                exit(1);
index 41eb70094ecea482cfde4277c4b896acdb9dfb08..1c96bf64cf65908fe6b41da7d014cfaa1f452c70 100644 (file)
@@ -47,6 +47,7 @@ static void popt_common_callback(poptContext con,
                           const char *arg, const void *data)
 {
        const char *pname;
+       struct loadparm_context *lp_ctx = global_loadparm; /* FIXME: allow overriding */
 
        if (reason == POPT_CALLBACK_REASON_POST) {
                if (!lp_loaded()) {
@@ -81,7 +82,7 @@ static void popt_common_callback(poptContext con,
 
        switch(opt->val) {
        case 'd':
-               lp_set_cmdline(global_loadparm, "log level", arg);
+               lp_set_cmdline(lp_ctx, "log level", arg);
                break;
 
        case OPT_DEBUG_STDERR:
@@ -94,7 +95,7 @@ static void popt_common_callback(poptContext con,
 
        case 'O':
                if (arg) {
-                       lp_set_cmdline(global_loadparm, "socket options", arg);
+                       lp_set_cmdline(lp_ctx, "socket options", arg);
                }
                break;
 
@@ -107,37 +108,37 @@ static void popt_common_callback(poptContext con,
        case 'l':
                if (arg) {
                        char *new_logfile = talloc_asprintf(NULL, "%s/log.%s", arg, pname);
-                       lp_set_cmdline(global_loadparm, "log file", new_logfile);
+                       lp_set_cmdline(lp_ctx, "log file", new_logfile);
                        talloc_free(new_logfile);
                }
                break;
                
        case 'W':
-               lp_set_cmdline(global_loadparm, "workgroup", arg);
+               lp_set_cmdline(lp_ctx, "workgroup", arg);
                break;
 
        case 'r':
-               lp_set_cmdline(global_loadparm, "realm", arg);
+               lp_set_cmdline(lp_ctx, "realm", arg);
                break;
                
        case 'n':
-               lp_set_cmdline(global_loadparm, "netbios name", arg);
+               lp_set_cmdline(lp_ctx, "netbios name", arg);
                break;
                
        case 'i':
-               lp_set_cmdline(global_loadparm, "netbios scope", arg);
+               lp_set_cmdline(lp_ctx, "netbios scope", arg);
                break;
 
        case 'm':
-               lp_set_cmdline(global_loadparm, "client max protocol", arg);
+               lp_set_cmdline(lp_ctx, "client max protocol", arg);
                break;
 
        case 'R':
-               lp_set_cmdline(global_loadparm, "name resolve order", arg);
+               lp_set_cmdline(lp_ctx, "name resolve order", arg);
                break;
 
        case OPT_OPTION:
-               if (!lp_set_option(global_loadparm, arg)) {
+               if (!lp_set_option(lp_ctx, arg)) {
                        fprintf(stderr, "Error setting option '%s'\n", arg);
                        exit(1);
                }
index c1159dde2e26c094a0946469759b8e9075e25fda..c53e3dfbe539bfbe51a964ffb2386081020b5963 100644 (file)
@@ -164,6 +164,7 @@ struct registry_context {
 
 struct auth_session_info;
 struct event_context;
+struct loadparm_context;
 
 /**
  * Open the locally defined registry.
@@ -175,6 +176,7 @@ WERROR reg_open_local(TALLOC_CTX *mem_ctx,
 
 WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
                      struct registry_context **ctx,
+                     struct loadparm_context *lp_ctx,
                      struct auth_session_info *session_info,
                      struct cli_credentials *credentials);
 
index 7e33f43a14925a297c2c8a11b6ab919e0caa929f..330f0856e1291b979300788ef44950175dac1f26 100644 (file)
@@ -135,6 +135,7 @@ typedef struct hive_key {
 
 WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
                       struct registry_context **ctx,
+                      struct loadparm_context *lp_ctx,
                       struct auth_session_info *session_info,
                       struct cli_credentials *credentials);
 
index 2397432f0bc1e043f0640a688bc91f633cff786f..a5a60ba61087b7e4e9b071079417fb4b7d283e61 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 static WERROR mount_samba_hive(struct registry_context *ctx,
+                              struct loadparm_context *lp_ctx,
                               struct auth_session_info *auth_info,
                               struct cli_credentials *creds,
                               const char *name,
@@ -36,7 +37,7 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
        const char *location;
 
        location = talloc_asprintf(ctx, "%s/%s.ldb",
-                                  lp_private_dir(global_loadparm),
+                                  lp_private_dir(lp_ctx),
                                   name);
 
        error = reg_open_hive(ctx, location, auth_info, creds, &hive);
@@ -54,6 +55,7 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
 
 _PUBLIC_ WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
                               struct registry_context **ctx,
+                              struct loadparm_context *lp_ctx,
                               struct auth_session_info *session_info,
                               struct cli_credentials *credentials)
 {
@@ -64,18 +66,18 @@ _PUBLIC_ WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
                return result;
        }
 
-       mount_samba_hive(*ctx, session_info, credentials,
+       mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
                         "hklm", HKEY_LOCAL_MACHINE);
 
-       mount_samba_hive(*ctx, session_info, credentials,
+       mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
                         "hkcr", HKEY_CLASSES_ROOT);
 
        /* FIXME: Should be mounted from NTUSER.DAT in the home directory of the
         * current user */
-       mount_samba_hive(*ctx, session_info, credentials,
+       mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
                         "hkcu", HKEY_CURRENT_USER);
 
-       mount_samba_hive(*ctx, session_info, credentials,
+       mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
                         "hku", HKEY_USERS);
 
        /* FIXME: Different hive backend for HKEY_CLASSES_ROOT: merged view of HKEY_LOCAL_MACHINE\Software\Classes
index 0233f27437a6773827ce6fcd40a64fdc1f7e7994..6d766fd25c41e41210f0b5d6f92f2431ec5ace35 100644 (file)
@@ -65,12 +65,12 @@ struct registry_key *reg_common_open_file(const char *path,
        return reg_import_hive_key(h, hive_root, -1, NULL);
 }
 
-struct registry_context *reg_common_open_local(struct cli_credentials *creds)
+struct registry_context *reg_common_open_local(struct cli_credentials *creds, struct loadparm_context *lp_ctx)
 {
        WERROR error;
        struct registry_context *h;
 
-       error = reg_open_samba(NULL, &h, NULL, creds);
+       error = reg_open_samba(NULL, &h, lp_ctx, NULL, creds);
 
        if(!W_ERROR_IS_OK(error)) {
                fprintf(stderr, "Unable to open local registry:%s \n",
index f96761cda0c69c8b9a9d2c8e71df540d1292a591..1996861a2a62afd62dd6dcdd3a36801eef44b526 100644 (file)
 #include "lib/events/events.h"
 #include "lib/cmdline/popt_common.h"
 #include "lib/registry/tools/common.h"
+#include "param/param.h"
 
 enum reg_backend { REG_UNKNOWN, REG_LOCAL, REG_REMOTE, REG_NULL };
 
 static struct registry_context *open_backend(poptContext pc,
+                                            struct loadparm_context *lp_ctx,
                                             enum reg_backend backend,
                                             const char *remote_host)
 {
@@ -39,7 +41,7 @@ static struct registry_context *open_backend(poptContext pc,
                poptPrintUsage(pc, stderr, 0);
                return NULL;
        case REG_LOCAL:
-               error = reg_open_samba(NULL, &ctx, NULL, cmdline_credentials);
+               error = reg_open_samba(NULL, &ctx, lp_ctx, NULL, cmdline_credentials);
                break;
        case REG_REMOTE:
                error = reg_open_remote(&ctx, NULL, cmdline_credentials,
@@ -114,11 +116,11 @@ int main(int argc, const char **argv)
 
        }
 
-       h1 = open_backend(pc, backend1, remote1);
+       h1 = open_backend(pc, global_loadparm, backend1, remote1);
        if (h1 == NULL)
                return 1;
 
-       h2 = open_backend(pc, backend2, remote2);
+       h2 = open_backend(pc, global_loadparm, backend2, remote2);
        if (h2 == NULL)
                return 1;
 
index 35f12c7e6241009fcad7389dbc393f081e2c84d9..2f2cf789a93641e36429f6c6f632477a5dc14bc2 100644 (file)
@@ -24,6 +24,7 @@
 #include "lib/cmdline/popt_common.h"
 #include "lib/registry/tools/common.h"
 #include "lib/registry/patchfile.h"
+#include "param/param.h"
 
 int main(int argc, char **argv)
 {
@@ -50,7 +51,7 @@ int main(int argc, char **argv)
        if (remote) {
                h = reg_common_open_remote (remote, cmdline_credentials);
        } else {
-               h = reg_common_open_local (cmdline_credentials);
+               h = reg_common_open_local (cmdline_credentials, global_loadparm);
        }
 
        if (h == NULL)
index 7dbcf2f875fe1ba6da5ada2c09118682c16c0fea..9b582c3c024f0d4a8b1180b510664420a7d81321 100644 (file)
@@ -26,6 +26,7 @@
 #include "lib/smbreadline/smbreadline.h"
 #include "librpc/gen_ndr/ndr_security.h"
 #include "lib/registry/tools/common.h"
+#include "param/param.h"
 
 struct regshell_context {
        struct registry_context *registry;
@@ -505,7 +506,7 @@ int main(int argc, char **argv)
                ctx->registry = ctx->current->context;
                ctx->path = talloc_strdup(ctx, "");
        } else {
-               ctx->registry = reg_common_open_local(cmdline_credentials);
+               ctx->registry = reg_common_open_local(cmdline_credentials, global_loadparm);
        }
 
        if (ctx->registry == NULL)
index 9f8d8c012d7d1a92e3769a2e362db09e77e29fcd..f95fc1968df13d649bc1734b0790e62bc068276d 100644 (file)
@@ -23,6 +23,7 @@
 #include "lib/registry/tools/common.h"
 #include "lib/events/events.h"
 #include "lib/cmdline/popt_common.h"
+#include "param/param.h"
 
 /**
  * Print a registry key recursively
@@ -132,7 +133,7 @@ int main(int argc, char **argv)
        } else if (file != NULL) {
                start_key = reg_common_open_file(file, cmdline_credentials);
        } else {
-               h = reg_common_open_local(cmdline_credentials);
+               h = reg_common_open_local(cmdline_credentials, global_loadparm);
        }
 
        if (h == NULL && start_key == NULL)
index d80665375818544d2ff6f1138cde20750b28ca11..39f97f4d8c2d577a881845ae10ffb0fd98d0afb0 100644 (file)
@@ -55,9 +55,9 @@ bool smbcli_transport_establish(struct smbcli_state *cli,
 }
 
 /* wrapper around smb_raw_negotiate() */
-NTSTATUS smbcli_negprot(struct smbcli_state *cli, int maxprotocol)
+NTSTATUS smbcli_negprot(struct smbcli_state *cli, bool unicode, int maxprotocol)
 {
-       return smb_raw_negotiate(cli->transport, maxprotocol);
+       return smb_raw_negotiate(cli->transport, unicode, maxprotocol);
 }
 
 /* wrapper around smb_raw_sesssetup() */
index 82d6fe5236c23886d906a6dfd4cfa7ef9b8521ce..78b9082521baff22d26bb16e6b3086be5b1677bc 100644 (file)
@@ -46,6 +46,7 @@ static const struct {
   Send a negprot command.
 */
 struct smbcli_request *smb_raw_negotiate_send(struct smbcli_transport *transport, 
+                                             bool unicode,
                                              int maxprotocol)
 {
        struct smbcli_request *req;
@@ -58,7 +59,7 @@ struct smbcli_request *smb_raw_negotiate_send(struct smbcli_transport *transport
        }
 
        flags2 |= FLAGS2_32_BIT_ERROR_CODES;
-       if (lp_unicode(global_loadparm)) {
+       if (unicode) {
                flags2 |= FLAGS2_UNICODE_STRINGS;
        }
        flags2 |= FLAGS2_EXTENDED_ATTRIBUTES;
@@ -190,8 +191,8 @@ failed:
 /*
  Send a negprot command (sync interface)
 */
-NTSTATUS smb_raw_negotiate(struct smbcli_transport *transport, int maxprotocol)
+NTSTATUS smb_raw_negotiate(struct smbcli_transport *transport, bool unicode, int maxprotocol)
 {
-       struct smbcli_request *req = smb_raw_negotiate_send(transport, maxprotocol);
+       struct smbcli_request *req = smb_raw_negotiate_send(transport, unicode, maxprotocol);
        return smb_raw_negotiate_recv(req);
 }
index 9f18c0d92430d805c6b0e5dd2ab5d8da015721bd..0238d5c55061ed4d05183ced1823708485404186 100644 (file)
@@ -63,7 +63,7 @@ static NTSTATUS connect_send_negprot(struct composite_context *c,
 {
        struct connect_state *state = talloc_get_type(c->private_data, struct connect_state);
 
-       state->req = smb_raw_negotiate_send(state->transport, 
+       state->req = smb_raw_negotiate_send(state->transport, lp_unicode(global_loadparm),
                                            lp_cli_maxprotocol(global_loadparm));
        NT_STATUS_HAVE_NO_MEMORY(state->req);
 
index 458d90c616444a1a38ecf0b46bbb1ad468963781..56cb4176f4dcc6b88f2ce8f9611edf191dc08430 100644 (file)
@@ -229,4 +229,7 @@ struct ntptr_critical_sizes {
        int sizeof_ntptr_context;
        int sizeof_ntptr_ops;
 };
+
+struct loadparm_context;
+
 #include "ntptr/ntptr_proto.h"
index 379c4e54134a44021a870d21ec875fe486f59fb1..1a14c3b33ec34a73715b300e71b1bacb424f613b 100644 (file)
@@ -69,10 +69,10 @@ NTSTATUS ntptr_register(const void *_ops)
        return NT_STATUS_OK;
 }
 
-NTSTATUS ntptr_init(void)
+NTSTATUS ntptr_init(struct loadparm_context *lp_ctx)
 {
        init_module_fn static_init[] = STATIC_ntptr_MODULES;
-       init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "ntptr");
+       init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "ntptr");
 
        run_init_functions(static_init);
        run_init_functions(shared_init);
index 489049f39f7bffbcb51fda3959b0f65fa11f2129..6c0269d5fc28e50fa40cbc2e748e6ac250803582 100644 (file)
@@ -149,10 +149,10 @@ NTSTATUS share_get_context(TALLOC_CTX *mem_ctx, struct share_context **ctx)
 /*
   initialise the SHARE subsystem
 */
-NTSTATUS share_init(void)
+NTSTATUS share_init(struct loadparm_context *lp_ctx)
 {
        init_module_fn static_init[] = STATIC_share_MODULES;
-       init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "share");
+       init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "share");
 
        run_init_functions(static_init);
        run_init_functions(shared_init);
index c93d0d985722dab9bbb312b7d338b0339e5f81c0..fae1c31c135846e84f2bbc0f13ca1f1e34cbae96 100644 (file)
@@ -61,6 +61,8 @@ struct share_ops {
        NTSTATUS (*remove)(struct share_context *, const char *);
 };
 
+struct loadparm_context;
+
 #include "param/share_proto.h"
 
 /* list of shares options */
index de93e3c591a39c9fd866273cc8a88444d38ccbd7..26af71d06f8a28462f4dab99ffa1cd75c6da5ebf 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "includes.h"
 #include "param/share.h"
+#include "param/param.h"
 #include "torture/torture.h"
 
 static bool test_list_empty(struct torture_context *tctx, 
@@ -196,7 +197,7 @@ struct torture_suite *torture_local_share(TALLOC_CTX *mem_ctx)
        struct torture_suite *suite = torture_suite_create(mem_ctx, "SHARE");
        struct torture_tcase *tcase;
 
-       share_init();
+       share_init(global_loadparm);
 
        tcase = torture_suite_add_tcase(suite, "ldb");
        torture_tcase_set_fixture(tcase, setup_ldb, teardown);
index 14da907dfa922205c44c782e088019bdc751b178..5be9d837e1667f6c70984a982b6bac0bacd03fe8 100644 (file)
@@ -25,6 +25,7 @@
 #include "librpc/gen_ndr/ndr_winreg.h"
 #include "rpc_server/common/common.h"
 #include "librpc/gen_ndr/ndr_security.h"
+#include "param/param.h"
 
 enum handle_types { HTYPE_REGVAL, HTYPE_REGKEY };
 
@@ -35,6 +36,7 @@ static NTSTATUS dcerpc_winreg_bind(struct dcesrv_call_state *dce_call,
        WERROR err;
 
        err = reg_open_samba(dce_call->context,
+                            global_loadparm,
                             &ctx, dce_call->conn->auth_state.session_info,
                             NULL);
 
index 38634b996c9f1f91edc3f17367958266349c7b37..fee11b66d96d7d4acd15553c7cc41b0e42dbb56c 100644 (file)
@@ -70,7 +70,7 @@ static int ejs_reg_open(MprVarHandle eid, int argc, struct MprVar **argv)
        struct registry_context *rctx;
        WERROR error;
 
-       error = reg_open_samba(mprMemCtx(), &rctx, NULL, NULL);
+       error = reg_open_samba(mprMemCtx(), &rctx, global_loadparm, NULL, NULL);
        SMB_ASSERT(W_ERROR_IS_OK(error));
 
        mprSetPtrChild(reg, "registry", rctx);
index 973b6b993ebb3cf7e9294bdc0bd58ac635884e7c..3f590decca013d36f76b2ca44b9cab53a760f090 100644 (file)
@@ -643,7 +643,7 @@ error:
 /*
  * init the SMB protocol related stuff
  */
-NTSTATUS smbsrv_init_smb_connection(struct smbsrv_connection *smb_conn)
+NTSTATUS smbsrv_init_smb_connection(struct smbsrv_connection *smb_conn, struct loadparm_context *lp_ctx)
 {
        NTSTATUS status;
 
@@ -652,12 +652,12 @@ NTSTATUS smbsrv_init_smb_connection(struct smbsrv_connection *smb_conn)
 
        /* this is the size that w2k uses, and it appears to be important for
           good performance */
-       smb_conn->negotiate.max_recv = lp_max_xmit(global_loadparm);
+       smb_conn->negotiate.max_recv = lp_max_xmit(lp_ctx);
 
        smb_conn->negotiate.zone_offset = get_time_zone(time(NULL));
 
-       smb_conn->config.security = lp_security(global_loadparm);
-       smb_conn->config.nt_status_support = lp_nt_status_support(global_loadparm);
+       smb_conn->config.security = lp_security(lp_ctx);
+       smb_conn->config.nt_status_support = lp_nt_status_support(lp_ctx);
 
        status = smbsrv_init_sessions(smb_conn, UINT16_MAX);
        NT_STATUS_NOT_OK_RETURN(status);
index 9242fb1a1219ea812442b25a9b29288753767bb0..923c1bdfe5e511e920af2151bf9bde8decd9b3c1 100644 (file)
@@ -42,7 +42,7 @@ static NTSTATUS smbsrv_recv_generic_request(void *private, DATA_BLOB blob)
 
        /* see if its a special NBT packet */
        if (CVAL(blob.data,0) != 0) {
-               status = smbsrv_init_smb_connection(smb_conn);
+               status = smbsrv_init_smb_connection(smb_conn, global_loadparm);
                NT_STATUS_NOT_OK_RETURN(status);
                packet_set_callback(smb_conn->packet, smbsrv_recv_smb_request);
                return smbsrv_recv_smb_request(smb_conn, blob);
@@ -58,7 +58,7 @@ static NTSTATUS smbsrv_recv_generic_request(void *private, DATA_BLOB blob)
 
        switch (protocol_version) {
        case SMB_MAGIC:
-               status = smbsrv_init_smb_connection(smb_conn);
+               status = smbsrv_init_smb_connection(smb_conn, global_loadparm);
                NT_STATUS_NOT_OK_RETURN(status);
                packet_set_callback(smb_conn->packet, smbsrv_recv_smb_request);
                return smbsrv_recv_smb_request(smb_conn, blob);
index 8ebd3e683fbe5a830f7814934037a18c09e2b8d4..4af6ef1362f8635c2bab936f3435dbc2fc00ef53 100644 (file)
@@ -382,6 +382,8 @@ NTSTATUS smbsrv_add_socket(struct event_context *event_context,
                               const struct model_ops *model_ops,
                               const char *address);
 
+struct loadparm_context;
+
 #include "smb_server/smb_server_proto.h"
 #include "smb_server/smb/smb_proto.h"
 
index 4847ddd7b5253d1329cd1316dfa41efa9d0455f7..3567846070ac4ffeb755a48bcf1db8b8bd766d2b 100644 (file)
  * return the pid in a pidfile. return 0 if the process (or pidfile)
  * does not exist 
  */
-pid_t pidfile_pid(const char *name)
+pid_t pidfile_pid(const char *piddir, const char *name)
 {
        int fd;
        char pidstr[20];
        pid_t ret;
        char *pidFile;
 
-       asprintf(&pidFile, "%s/%s.pid", lp_piddir(global_loadparm), name);
+       asprintf(&pidFile, "%s/%s.pid", piddir, name);
 
        fd = open(pidFile, O_NONBLOCK | O_RDONLY, 0644);
 
@@ -80,16 +80,16 @@ pid_t pidfile_pid(const char *name)
 /**
  * create a pid file in the pid directory. open it and leave it locked 
  */
-void pidfile_create(const char *name)
+void pidfile_create(const char *piddir, const char *name)
 {
        int     fd;
        char    buf[20];
        char *pidFile;
        pid_t pid;
 
-       asprintf(&pidFile, "%s/%s.pid", lp_piddir(global_loadparm), name);
+       asprintf(&pidFile, "%s/%s.pid", piddir, name);
 
-       pid = pidfile_pid(name);
+       pid = pidfile_pid(piddir, name);
        if (pid != 0) {
                DEBUG(0,("ERROR: %s is already running. File %s exists and process id %d is running.\n", 
                         name, pidFile, (int)pid));
index bb4d3a53bbfc1fb635ed7982bef75582e99d8c9e..e240ae2c6093f38661685e880aecc8738c6be29e 100644 (file)
@@ -80,10 +80,10 @@ _PUBLIC_ NTSTATUS register_process_model(const void *_ops)
        return NT_STATUS_OK;
 }
 
-NTSTATUS process_model_init(void)
+NTSTATUS process_model_init(struct loadparm_context *lp_ctx)
 {
        init_module_fn static_init[] = STATIC_process_model_MODULES;
-       init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "process_model");
+       init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "process_model");
 
        run_init_functions(static_init);
        run_init_functions(shared_init);
index 5dac250ee85fc818b3883a2a96a37eb9616b7049..65196618db96cce84744c44fe0d7dfa3e2fd1e00 100644 (file)
@@ -88,12 +88,12 @@ static void recursive_delete(const char *path)
   range locking system. So instead of putting the burden on tdb to
   cleanup tmp files, this function deletes them. 
 */
-static void cleanup_tmp_files(void)
+static void cleanup_tmp_files(struct loadparm_context *lp_ctx)
 {
        char *path;
        TALLOC_CTX *mem_ctx = talloc_new(NULL);
 
-       path = smbd_tmp_path(mem_ctx, global_loadparm, NULL);
+       path = smbd_tmp_path(mem_ctx, lp_ctx, NULL);
 
        recursive_delete(path);
        talloc_free(mem_ctx);
@@ -267,13 +267,13 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[
                become_daemon(true);
        }
 
-       cleanup_tmp_files();
+       cleanup_tmp_files(global_loadparm);
 
        if (!directory_exist(lp_lockdir(global_loadparm))) {
                mkdir(lp_lockdir(global_loadparm), 0755);
        }
 
-       pidfile_create(binary_name);
+       pidfile_create(lp_piddir(global_loadparm), binary_name);
 
        /* Do *not* remove this, until you have removed
         * passdb/secrets.c, and proved that Samba still builds... */
@@ -284,17 +284,17 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[
 
        ldb_global_init(); /* FIXME: */
 
-       share_init();
+       share_init(global_loadparm);
 
        gensec_init(global_loadparm); /* FIXME: */
 
-       ntptr_init();   /* FIXME: maybe run this in the initialization function 
+       ntptr_init(global_loadparm);    /* FIXME: maybe run this in the initialization function 
                                                of the spoolss RPC server instead? */
 
        ntvfs_init();   /* FIXME: maybe run this in the initialization functions 
                                                of the SMB[,2] server instead? */
 
-       process_model_init(); 
+       process_model_init(global_loadparm); 
 
        shared_init = load_samba_modules(NULL, global_loadparm, "service");
 
index 1415b4195f725d7e2231e10e78f24508d984f1d6..5c5428d61f345df334d487eb913fdd1104d2cbfb 100644 (file)
@@ -355,7 +355,7 @@ static bool run_negprot_nowait(struct torture_context *tctx)
 
        for (i=0;i<100;i++) {
                struct smbcli_request *req;
-               req = smb_raw_negotiate_send(cli->transport, PROTOCOL_NT1);
+               req = smb_raw_negotiate_send(cli->transport, lp_unicode(global_loadparm), PROTOCOL_NT1);
                event_loop_once(cli->transport->socket->event.ctx);
                if (req->state == SMBCLI_REQUEST_ERROR) {
                        if (i > 0) {
index ff5c20e258766316fde85728982344c45e0767f1..9a2f518535b96e87515384399a68f7655b75ac35 100644 (file)
@@ -1228,17 +1228,11 @@ static bool test_NetrJoinDomain2(struct torture_context *tctx,
                        break;
        }
 
-       domain_admin_account = lp_parm_string(global_loadparm, NULL,
-                                             "torture",
-                                             "domain_admin_account");
+       domain_admin_account = torture_setting_string(tctx, "domain_admin_account", NULL);
 
-       domain_admin_password = lp_parm_string(global_loadparm, NULL,
-                                              "torture",
-                                              "domain_admin_password");
+       domain_admin_password = torture_setting_string(tctx, "domain_admin_password", NULL);
 
-       domain_name = lp_parm_string(global_loadparm, NULL,
-                                    "torture",
-                                    "domain_name");
+       domain_name = torture_setting_string(tctx, "domain_name", NULL);
 
        if ((domain_admin_account == NULL) ||
            (domain_admin_password == NULL) ||
@@ -1318,13 +1312,9 @@ static bool test_NetrUnjoinDomain2(struct torture_context *tctx,
                        break;
        }
 
-       domain_admin_account = lp_parm_string(global_loadparm, NULL,
-                                             "torture",
-                                             "domain_admin_account");
+       domain_admin_account = torture_setting_string(tctx, "domain_admin_account", NULL);
 
-       domain_admin_password = lp_parm_string(global_loadparm, NULL,
-                                              "torture",
-                                              "domain_admin_password");
+       domain_admin_password = torture_setting_string(tctx, "domain_admin_password", NULL);
 
        if ((domain_admin_account == NULL) ||
            (domain_admin_password == NULL)) {
index 75c87fc111ea0b743ce3954499097c2a32a65391..72c99c112645380f770540e39cd5469e0c23de68 100644 (file)
@@ -129,7 +129,7 @@ static bool parse_ntlm_auth_domain_user(const char *domuser, fstring domain,
                                        fstring user)
 {
 
-       char *p = strchr(domuser,*lp_winbind_separator(global_loadparm));
+       char *p = strchr(domuser, *lp_winbind_separator(global_loadparm));
 
        if (!p) {
                return false;