diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-02 22:32:11 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:47:15 +0100 |
commit | 6c999cd12344f2bb8b1d2941210b4c205b3e0aad (patch) | |
tree | 0911e4ca75694e080173c2863e2c41ff5881309c /source4 | |
parent | 934e932387ea5668ec000bcefe4ec86935297339 (diff) | |
download | samba-6c999cd12344f2bb8b1d2941210b4c205b3e0aad.tar.gz |
r26236: Remove more uses of global_loadparm or specify loadparm_context explicitly.
(This used to be commit 5b29ef7c03d9ae76b0ca909e9f03a58e1bad3521)
Diffstat (limited to 'source4')
31 files changed, 93 insertions, 81 deletions
diff --git a/source4/auth/auth_server.c b/source4/auth/auth_server.c index d391793bd9a..900ca8d05e9 100644 --- a/source4/auth/auth_server.c +++ b/source4/auth/auth_server.c @@ -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; } diff --git a/source4/auth/gensec/gensec_krb5.c b/source4/auth/gensec/gensec_krb5.c index 1227a48ada0..391d231f97a 100644 --- a/source4/auth/gensec/gensec_krb5.c +++ b/source4/auth/gensec/gensec_krb5.c @@ -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; } diff --git a/source4/client/smbmount.c b/source4/client/smbmount.c index 1ac524dd0cb..34fb90fca67 100644 --- a/source4/client/smbmount.c +++ b/source4/client/smbmount.c @@ -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); diff --git a/source4/lib/cmdline/popt_common.c b/source4/lib/cmdline/popt_common.c index 41eb70094ec..1c96bf64cf6 100644 --- a/source4/lib/cmdline/popt_common.c +++ b/source4/lib/cmdline/popt_common.c @@ -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); } diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index c1159dde2e2..c53e3dfbe53 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -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); diff --git a/source4/lib/registry/registry.i b/source4/lib/registry/registry.i index 7e33f43a149..330f0856e12 100644 --- a/source4/lib/registry/registry.i +++ b/source4/lib/registry/registry.i @@ -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); diff --git a/source4/lib/registry/samba.c b/source4/lib/registry/samba.c index 2397432f0bc..a5a60ba6108 100644 --- a/source4/lib/registry/samba.c +++ b/source4/lib/registry/samba.c @@ -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 diff --git a/source4/lib/registry/tools/common.c b/source4/lib/registry/tools/common.c index 0233f27437a..6d766fd25c4 100644 --- a/source4/lib/registry/tools/common.c +++ b/source4/lib/registry/tools/common.c @@ -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", diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c index f96761cda0c..1996861a2a6 100644 --- a/source4/lib/registry/tools/regdiff.c +++ b/source4/lib/registry/tools/regdiff.c @@ -24,10 +24,12 @@ #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; diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c index 35f12c7e624..2f2cf789a93 100644 --- a/source4/lib/registry/tools/regpatch.c +++ b/source4/lib/registry/tools/regpatch.c @@ -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) diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 7dbcf2f875f..9b582c3c024 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -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) diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index 9f8d8c012d7..f95fc1968df 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -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) diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index d8066537581..39f97f4d8c2 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -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() */ diff --git a/source4/libcli/raw/rawnegotiate.c b/source4/libcli/raw/rawnegotiate.c index 82d6fe5236c..78b9082521b 100644 --- a/source4/libcli/raw/rawnegotiate.c +++ b/source4/libcli/raw/rawnegotiate.c @@ -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); } diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c index 9f18c0d9243..0238d5c5506 100644 --- a/source4/libcli/smb_composite/connect.c +++ b/source4/libcli/smb_composite/connect.c @@ -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); diff --git a/source4/ntptr/ntptr.h b/source4/ntptr/ntptr.h index 458d90c6164..56cb4176f4d 100644 --- a/source4/ntptr/ntptr.h +++ b/source4/ntptr/ntptr.h @@ -229,4 +229,7 @@ struct ntptr_critical_sizes { int sizeof_ntptr_context; int sizeof_ntptr_ops; }; + +struct loadparm_context; + #include "ntptr/ntptr_proto.h" diff --git a/source4/ntptr/ntptr_base.c b/source4/ntptr/ntptr_base.c index 379c4e54134..1a14c3b33ec 100644 --- a/source4/ntptr/ntptr_base.c +++ b/source4/ntptr/ntptr_base.c @@ -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); diff --git a/source4/param/share.c b/source4/param/share.c index 489049f39f7..6c0269d5fc2 100644 --- a/source4/param/share.c +++ b/source4/param/share.c @@ -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); diff --git a/source4/param/share.h b/source4/param/share.h index c93d0d98572..fae1c31c135 100644 --- a/source4/param/share.h +++ b/source4/param/share.h @@ -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 */ diff --git a/source4/param/tests/share.c b/source4/param/tests/share.c index de93e3c591a..26af71d06f8 100644 --- a/source4/param/tests/share.c +++ b/source4/param/tests/share.c @@ -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); diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c index 14da907dfa9..5be9d837e16 100644 --- a/source4/rpc_server/winreg/rpc_winreg.c +++ b/source4/rpc_server/winreg/rpc_winreg.c @@ -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); diff --git a/source4/scripting/ejs/smbcalls_reg.c b/source4/scripting/ejs/smbcalls_reg.c index 38634b996c9..fee11b66d96 100644 --- a/source4/scripting/ejs/smbcalls_reg.c +++ b/source4/scripting/ejs/smbcalls_reg.c @@ -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); diff --git a/source4/smb_server/smb/receive.c b/source4/smb_server/smb/receive.c index 973b6b993eb..3f590decca0 100644 --- a/source4/smb_server/smb/receive.c +++ b/source4/smb_server/smb/receive.c @@ -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); diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c index 9242fb1a121..923c1bdfe5e 100644 --- a/source4/smb_server/smb_server.c +++ b/source4/smb_server/smb_server.c @@ -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); diff --git a/source4/smb_server/smb_server.h b/source4/smb_server/smb_server.h index 8ebd3e683fb..4af6ef1362f 100644 --- a/source4/smb_server/smb_server.h +++ b/source4/smb_server/smb_server.h @@ -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" diff --git a/source4/smbd/pidfile.c b/source4/smbd/pidfile.c index 4847ddd7b52..3567846070a 100644 --- a/source4/smbd/pidfile.c +++ b/source4/smbd/pidfile.c @@ -33,14 +33,14 @@ * 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)); diff --git a/source4/smbd/process_model.c b/source4/smbd/process_model.c index bb4d3a53bbf..e240ae2c609 100644 --- a/source4/smbd/process_model.c +++ b/source4/smbd/process_model.c @@ -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); diff --git a/source4/smbd/server.c b/source4/smbd/server.c index 5dac250ee85..65196618db9 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -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"); diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index 1415b4195f7..5c5428d61f3 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -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) { diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c index ff5c20e2587..9a2f518535b 100644 --- a/source4/torture/rpc/wkssvc.c +++ b/source4/torture/rpc/wkssvc.c @@ -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)) { diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c index 75c87fc111e..72c99c11264 100644 --- a/source4/utils/ntlm_auth.c +++ b/source4/utils/ntlm_auth.c @@ -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; |