From 0a2f1a46a02d2c9497d05d7e534829dc6e9430dc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 15:53:07 +0100 Subject: r26249: Remove a couple more uses of global_loadparm. (This used to be commit 80a61200508a00d5b16a3e748ce92d54b9fefcd2) --- source4/torture/basic/base.c | 6 +++--- source4/torture/basic/delete.c | 8 ++++---- source4/torture/basic/disconnect.c | 6 +++--- source4/torture/basic/misc.c | 2 +- source4/torture/basic/scanner.c | 2 +- source4/torture/nbench/nbench.c | 8 ++++---- source4/torture/nbench/nbio.c | 4 ++-- source4/torture/rap/rap.c | 4 ++-- source4/torture/raw/eas.c | 2 +- source4/torture/raw/lockbench.c | 6 ++++-- source4/torture/raw/notify.c | 32 ++++++++++++++++---------------- source4/torture/raw/open.c | 4 ++-- source4/torture/raw/openbench.c | 6 ++++-- source4/torture/raw/oplock.c | 2 +- source4/torture/raw/pingpong.c | 2 +- source4/torture/raw/samba3hide.c | 4 ++-- source4/torture/raw/samba3misc.c | 12 ++++++------ source4/torture/rpc/dfs.c | 13 ++++++++----- source4/torture/rpc/samba3rpc.c | 14 +++++++------- source4/torture/util_smb.c | 31 ++++++++++++++++--------------- source4/utils/ntlm_auth.c | 13 +++++++------ 21 files changed, 95 insertions(+), 86 deletions(-) diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index 9a5616e274..3e6c16f088 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -370,7 +370,7 @@ static bool run_negprot_nowait(struct torture_context *tctx) } torture_comment(tctx, "Opening secondary connection\n"); - if (!torture_open_connection(&cli2, 1)) { + if (!torture_open_connection(&cli2, tctx, 1)) { torture_comment(tctx, "Failed to open secondary connection\n"); correct = false; } @@ -1450,7 +1450,7 @@ static bool torture_samba3_errorpaths(struct torture_context *tctx) goto fail; } - if (!torture_open_connection(&cli_nt, 0)) { + if (!torture_open_connection(&cli_nt, tctx, 0)) { goto fail; } @@ -1459,7 +1459,7 @@ static bool torture_samba3_errorpaths(struct torture_context *tctx) goto fail; } - if (!torture_open_connection(&cli_dos, 1)) { + if (!torture_open_connection(&cli_dos, tctx, 1)) { goto fail; } diff --git a/source4/torture/basic/delete.c b/source4/torture/basic/delete.c index 38528cd845..8b84880c06 100644 --- a/source4/torture/basic/delete.c +++ b/source4/torture/basic/delete.c @@ -1373,10 +1373,10 @@ static bool deltest21(struct torture_context *tctx) struct smbcli_state *cli2; bool correct = true; - if (!torture_open_connection(&cli1, 0)) + if (!torture_open_connection(&cli1, tctx, 0)) return false; - if (!torture_open_connection(&cli2, 1)) + if (!torture_open_connection(&cli2, tctx, 1)) return false; del_clean_area(cli1, cli2); @@ -1404,7 +1404,7 @@ static bool deltest21(struct torture_context *tctx) fnum1 = -1; - if (!torture_open_connection(&cli1, 0)) { + if (!torture_open_connection(&cli1, tctx, 0)) { return false; } @@ -1440,7 +1440,7 @@ static bool deltest22(struct torture_context *tctx) struct smbcli_state *cli1; bool correct = true; - if (!torture_open_connection(&cli1, 0)) + if (!torture_open_connection(&cli1, tctx, 0)) return false; smbcli_deltree(cli1->tree, dname); diff --git a/source4/torture/basic/disconnect.c b/source4/torture/basic/disconnect.c index cb77bfe984..09f54ed6a7 100644 --- a/source4/torture/basic/disconnect.c +++ b/source4/torture/basic/disconnect.c @@ -136,7 +136,7 @@ bool torture_disconnect(struct torture_context *torture) mem_ctx = talloc_init("torture_raw_mux"); - if (!torture_open_connection(&cli, 0)) { + if (!torture_open_connection(&cli, torture, 0)) { return false; } @@ -146,12 +146,12 @@ bool torture_disconnect(struct torture_context *torture) for (i=0;i 1) { - if (!torture_open_connection(&cli, 0)) { + if (!torture_open_connection(&cli, torture, 0)) { return false; } diff --git a/source4/torture/nbench/nbio.c b/source4/torture/nbench/nbio.c index 5de903ff78..2664d3e7f5 100644 --- a/source4/torture/nbench/nbio.c +++ b/source4/torture/nbench/nbio.c @@ -157,7 +157,7 @@ static bool nb_reopen_all_files(void) return true; } -bool nb_reconnect(struct smbcli_state **cli, int client) +bool nb_reconnect(struct smbcli_state **cli, struct torture_context *tctx, int client) { children[client].connected = false; @@ -165,7 +165,7 @@ bool nb_reconnect(struct smbcli_state **cli, int client) talloc_free(*cli); } - if (!torture_open_connection(cli, client)) { + if (!torture_open_connection(cli, tctx, client)) { printf("nb_reconnect: failed to connect\n"); *cli = NULL; return false; diff --git a/source4/torture/rap/rap.c b/source4/torture/rap/rap.c index 9289577269..6c07a2747f 100644 --- a/source4/torture/rap/rap.c +++ b/source4/torture/rap/rap.c @@ -536,7 +536,7 @@ bool torture_rap_basic(struct torture_context *torture) bool ret = true; TALLOC_CTX *mem_ctx; - if (!torture_open_connection(&cli, 0)) { + if (!torture_open_connection(&cli, torture, 0)) { return false; } @@ -560,7 +560,7 @@ bool torture_rap_scan(struct torture_context *torture) mem_ctx = talloc_init("torture_rap_scan"); - if (!torture_open_connection(&cli, 0)) { + if (!torture_open_connection(&cli, torture, 0)) { return false; } diff --git a/source4/torture/raw/eas.c b/source4/torture/raw/eas.c index 53449a1505..bc4473b17a 100644 --- a/source4/torture/raw/eas.c +++ b/source4/torture/raw/eas.c @@ -469,7 +469,7 @@ bool torture_max_eas(struct torture_context *torture) struct smbcli_state *cli; bool ret = true; - if (!torture_open_connection(&cli, 0)) { + if (!torture_open_connection(&cli, torture, 0)) { return false; } diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 633264ce0a..81016fc563 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -42,6 +42,7 @@ static int num_connected; enum lock_stage {LOCK_INITIAL, LOCK_LOCK, LOCK_UNLOCK}; struct benchlock_state { + struct torture_context *tctx; struct event_context *ev; struct smbcli_tree *tree; TALLOC_CTX *mem_ctx; @@ -178,7 +179,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, state->te = NULL; - if (!torture_get_conn_index(state->client_num, state->mem_ctx, &host, &share)) { + if (!torture_get_conn_index(state->client_num, state->mem_ctx, state->tctx, &host, &share)) { DEBUG(0,("Can't find host/share for reconnect?!\n")); exit(1); } @@ -324,10 +325,11 @@ bool torture_bench_lock(struct torture_context *torture) printf("Opening %d connections\n", nprocs); for (i=0;itree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); fnum = io.ntcreatex.out.file.fnum; @@ -886,7 +886,7 @@ static bool test_notify_tdis(TALLOC_CTX *mem_ctx) CHECK_STATUS(status, NT_STATUS_OK); cli->tree = NULL; - status = smb_raw_changenotify_recv(req, mem_ctx, ¬ify); + status = smb_raw_changenotify_recv(req, tctx, ¬ify); CHECK_STATUS(status, NT_STATUS_OK); CHECK_VAL(notify.nttrans.out.num_changes, 0); @@ -898,7 +898,7 @@ done: /* basic testing of change notifies followed by a exit */ -static bool test_notify_exit(TALLOC_CTX *mem_ctx) +static bool test_notify_exit(struct torture_context *tctx) { bool ret = true; NTSTATUS status; @@ -910,7 +910,7 @@ static bool test_notify_exit(TALLOC_CTX *mem_ctx) printf("TESTING CHANGE NOTIFY FOLLOWED BY EXIT\n"); - if (!torture_open_connection(&cli, 0)) { + if (!torture_open_connection(&cli, tctx, 0)) { return false; } @@ -930,7 +930,7 @@ static bool test_notify_exit(TALLOC_CTX *mem_ctx) io.ntcreatex.in.security_flags = 0; io.ntcreatex.in.fname = BASEDIR; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); fnum = io.ntcreatex.out.file.fnum; @@ -947,7 +947,7 @@ static bool test_notify_exit(TALLOC_CTX *mem_ctx) status = smb_raw_exit(cli->session); CHECK_STATUS(status, NT_STATUS_OK); - status = smb_raw_changenotify_recv(req, mem_ctx, ¬ify); + status = smb_raw_changenotify_recv(req, tctx, ¬ify); CHECK_STATUS(status, NT_STATUS_OK); CHECK_VAL(notify.nttrans.out.num_changes, 0); @@ -959,7 +959,7 @@ done: /* basic testing of change notifies followed by a ulogoff */ -static bool test_notify_ulogoff(TALLOC_CTX *mem_ctx) +static bool test_notify_ulogoff(struct torture_context *tctx) { bool ret = true; NTSTATUS status; @@ -971,7 +971,7 @@ static bool test_notify_ulogoff(TALLOC_CTX *mem_ctx) printf("TESTING CHANGE NOTIFY FOLLOWED BY ULOGOFF\n"); - if (!torture_open_connection(&cli, 0)) { + if (!torture_open_connection(&cli, tctx, 0)) { return false; } @@ -991,7 +991,7 @@ static bool test_notify_ulogoff(TALLOC_CTX *mem_ctx) io.ntcreatex.in.security_flags = 0; io.ntcreatex.in.fname = BASEDIR; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); fnum = io.ntcreatex.out.file.fnum; @@ -1008,7 +1008,7 @@ static bool test_notify_ulogoff(TALLOC_CTX *mem_ctx) status = smb_raw_ulogoff(cli->session); CHECK_STATUS(status, NT_STATUS_OK); - status = smb_raw_changenotify_recv(req, mem_ctx, ¬ify); + status = smb_raw_changenotify_recv(req, tctx, ¬ify); CHECK_STATUS(status, NT_STATUS_OK); CHECK_VAL(notify.nttrans.out.num_changes, 0); @@ -1027,7 +1027,7 @@ static void tcp_dis_handler(struct smbcli_transport *t, void *p) /* basic testing of change notifies followed by tcp disconnect */ -static bool test_notify_tcp_dis(TALLOC_CTX *mem_ctx) +static bool test_notify_tcp_dis(struct torture_context *tctx) { bool ret = true; NTSTATUS status; @@ -1039,7 +1039,7 @@ static bool test_notify_tcp_dis(TALLOC_CTX *mem_ctx) printf("TESTING CHANGE NOTIFY FOLLOWED BY TCP DISCONNECT\n"); - if (!torture_open_connection(&cli, 0)) { + if (!torture_open_connection(&cli, tctx, 0)) { return false; } @@ -1059,7 +1059,7 @@ static bool test_notify_tcp_dis(TALLOC_CTX *mem_ctx) io.ntcreatex.in.security_flags = 0; io.ntcreatex.in.fname = BASEDIR; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); fnum = io.ntcreatex.out.file.fnum; @@ -1075,7 +1075,7 @@ static bool test_notify_tcp_dis(TALLOC_CTX *mem_ctx) smbcli_transport_idle_handler(cli->transport, tcp_dis_handler, 250, cli); - status = smb_raw_changenotify_recv(req, mem_ctx, ¬ify); + status = smb_raw_changenotify_recv(req, tctx, ¬ify); CHECK_STATUS(status, NT_STATUS_LOCAL_DISCONNECT); done: diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c index fb81f7d55c..47f32b619b 100644 --- a/source4/torture/raw/open.c +++ b/source4/torture/raw/open.c @@ -1363,7 +1363,7 @@ static bool test_raw_open_multi(struct torture_context *tctx) return false; } - if (!torture_open_connection_share(mem_ctx, &cli, host, share, ev)) { + if (!torture_open_connection_share(mem_ctx, &cli, tctx, host, share, ev)) { return false; } @@ -1371,7 +1371,7 @@ static bool test_raw_open_multi(struct torture_context *tctx) for (i=0; ite = NULL; - if (!torture_get_conn_index(state->client_num, state->mem_ctx, &host, &share)) { + if (!torture_get_conn_index(state->client_num, state->mem_ctx, state->tctx, &host, &share)) { DEBUG(0,("Can't find host/share for reconnect?!\n")); exit(1); } @@ -358,10 +359,11 @@ bool torture_bench_open(struct torture_context *torture) printf("Opening %d connections\n", nprocs); for (i=0;itransport->options.use_oplocks = lp_parm_bool(global_loadparm, NULL, "torture", - "use_oplocks", false); - (*c)->transport->options.use_level2_oplocks = lp_parm_bool(global_loadparm, NULL, "torture", - "use_level2_oplocks", false); + (*c)->transport->options.use_oplocks = torture_setting_bool(tctx, "use_oplocks", false); + (*c)->transport->options.use_level2_oplocks = torture_setting_bool(tctx, "use_level2_oplocks", false); return true; } _PUBLIC_ bool torture_get_conn_index(int conn_index, TALLOC_CTX *mem_ctx, + struct torture_context *tctx, char **host, char **share) { char **unc_list = NULL; int num_unc_names = 0; const char *p; - (*host) = talloc_strdup(mem_ctx, lp_parm_string(global_loadparm, NULL, "torture", "host")); - (*share) = talloc_strdup(mem_ctx, lp_parm_string(global_loadparm, NULL, "torture", "share")); + (*host) = talloc_strdup(mem_ctx, torture_setting_string(tctx, "host", NULL)); + (*share) = talloc_strdup(mem_ctx, torture_setting_string(tctx, "share", NULL)); - p = lp_parm_string(global_loadparm, NULL, "torture", "unclist"); + p = torture_setting_string(tctx, "unclist", NULL); if (!p) { return true; } @@ -524,25 +524,26 @@ _PUBLIC_ bool torture_get_conn_index(int conn_index, _PUBLIC_ bool torture_open_connection_ev(struct smbcli_state **c, int conn_index, + struct torture_context *tctx, struct event_context *ev) { char *host, *share; bool ret; - if (!torture_get_conn_index(conn_index, ev, &host, &share)) { + if (!torture_get_conn_index(conn_index, ev, tctx, &host, &share)) { return false; } - ret = torture_open_connection_share(NULL, c, host, share, ev); + ret = torture_open_connection_share(NULL, c, tctx, host, share, ev); talloc_free(host); talloc_free(share); return ret; } -_PUBLIC_ bool torture_open_connection(struct smbcli_state **c, int conn_index) +_PUBLIC_ bool torture_open_connection(struct smbcli_state **c, struct torture_context *tctx, int conn_index) { - return torture_open_connection_ev(c, conn_index, + return torture_open_connection_ev(c, conn_index, tctx, cli_credentials_get_event_context(cmdline_credentials)); } @@ -648,7 +649,7 @@ double torture_create_procs(struct torture_context *tctx, while (1) { - if (torture_open_connection(¤t_cli, i)) { + if (torture_open_connection(¤t_cli, tctx, i)) { break; } if (tries-- == 0) { @@ -766,8 +767,8 @@ static bool wrap_simple_2smb_test(struct torture_context *torture_ctx, struct smbcli_state *cli1, *cli2; - if (!torture_open_connection(&cli1, 0) || - !torture_open_connection(&cli2, 1)) + if (!torture_open_connection(&cli1, torture_ctx, 0) || + !torture_open_connection(&cli2, torture_ctx, 1)) return false; fn = test->fn; @@ -817,7 +818,7 @@ static bool wrap_simple_1smb_test(struct torture_context *torture_ctx, struct smbcli_state *cli1; - if (!torture_open_connection(&cli1, 0)) + if (!torture_open_connection(&cli1, torture_ctx, 0)) return false; fn = test->fn; diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c index 72c99c1126..8b767c8436 100644 --- a/source4/utils/ntlm_auth.c +++ b/source4/utils/ntlm_auth.c @@ -126,10 +126,10 @@ static void mux_printf(unsigned int mux_id, const char *format, ...) form DOMAIN/user into a domain and a user */ static bool parse_ntlm_auth_domain_user(const char *domuser, fstring domain, - fstring user) + fstring user, char winbind_separator) { - char *p = strchr(domuser, *lp_winbind_separator(global_loadparm)); + char *p = strchr(domuser, winbind_separator); if (!p) { return false; @@ -470,7 +470,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, if (!ev) { exit(1); } - msg = messaging_client_init(state, lp_messaging_path(state, global_loadparm), ev); + msg = messaging_client_init(state, lp_messaging_path(state, lp_ctx), ev); if (!msg) { exit(1); } @@ -483,7 +483,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, } creds = cli_credentials_init(state->gensec_state); - cli_credentials_set_conf(creds, global_loadparm); + cli_credentials_set_conf(creds, lp_ctx); if (opt_username) { cli_credentials_set_username(creds, opt_username, CRED_SPECIFIED); } @@ -668,7 +668,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, reply_code = "AF"; reply_arg = talloc_asprintf(state->gensec_state, "%s%s%s", session_info->server_info->domain_name, - lp_winbind_separator(global_loadparm), session_info->server_info->account_name); + lp_winbind_separator(lp_ctx), session_info->server_info->account_name); talloc_free(session_info); } } else if (state->gensec_state->gensec_role == GENSEC_CLIENT) { @@ -744,7 +744,8 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod fstring fstr_user; fstring fstr_domain; - if (!parse_ntlm_auth_domain_user(full_username, fstr_user, fstr_domain)) { + if (!parse_ntlm_auth_domain_user(full_username, fstr_user, fstr_domain, + *lp_winbind_separator(lp_ctx))) { /* username might be 'tainted', don't print into our new-line deleimianted stream */ mux_printf(mux_id, "Error: Could not parse into domain and username\n"); } -- cgit