summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-03 15:53:07 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:47:27 +0100
commit0a2f1a46a02d2c9497d05d7e534829dc6e9430dc (patch)
tree5647b3b0b98f97abc84a47a19613938345e0384c
parent53ae9bc9f6f66578948c3995073bdc1f1acae0f1 (diff)
downloadsamba-0a2f1a46a02d2c9497d05d7e534829dc6e9430dc.tar.gz
samba-0a2f1a46a02d2c9497d05d7e534829dc6e9430dc.tar.bz2
samba-0a2f1a46a02d2c9497d05d7e534829dc6e9430dc.zip
r26249: Remove a couple more uses of global_loadparm.
(This used to be commit 80a61200508a00d5b16a3e748ce92d54b9fefcd2)
-rw-r--r--source4/torture/basic/base.c6
-rw-r--r--source4/torture/basic/delete.c8
-rw-r--r--source4/torture/basic/disconnect.c6
-rw-r--r--source4/torture/basic/misc.c2
-rw-r--r--source4/torture/basic/scanner.c2
-rw-r--r--source4/torture/nbench/nbench.c8
-rw-r--r--source4/torture/nbench/nbio.c4
-rw-r--r--source4/torture/rap/rap.c4
-rw-r--r--source4/torture/raw/eas.c2
-rw-r--r--source4/torture/raw/lockbench.c6
-rw-r--r--source4/torture/raw/notify.c32
-rw-r--r--source4/torture/raw/open.c4
-rw-r--r--source4/torture/raw/openbench.c6
-rw-r--r--source4/torture/raw/oplock.c2
-rwxr-xr-xsource4/torture/raw/pingpong.c2
-rw-r--r--source4/torture/raw/samba3hide.c4
-rw-r--r--source4/torture/raw/samba3misc.c12
-rw-r--r--source4/torture/rpc/dfs.c13
-rw-r--r--source4/torture/rpc/samba3rpc.c14
-rw-r--r--source4/torture/util_smb.c31
-rw-r--r--source4/utils/ntlm_auth.c13
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<torture_numops;i++) {
ret &= test_disconnect_lock(cli, mem_ctx);
- if (!torture_open_connection(&cli, 0)) {
+ if (!torture_open_connection(&cli, torture, 0)) {
return false;
}
ret &= test_disconnect_open(cli, mem_ctx);
- if (!torture_open_connection(&cli, 0)) {
+ if (!torture_open_connection(&cli, torture, 0)) {
return false;
}
diff --git a/source4/torture/basic/misc.c b/source4/torture/basic/misc.c
index 46f74ee1b1..e9a41e8299 100644
--- a/source4/torture/basic/misc.c
+++ b/source4/torture/basic/misc.c
@@ -194,7 +194,7 @@ bool torture_holdcon(struct torture_context *tctx)
cli = malloc_array_p(struct smbcli_state *, torture_numops);
for (i=0;i<torture_numops;i++) {
- if (!torture_open_connection(&cli[i], i)) {
+ if (!torture_open_connection(&cli[i], tctx, i)) {
return false;
}
if (torture_setting_bool(tctx, "progress", true)) {
diff --git a/source4/torture/basic/scanner.c b/source4/torture/basic/scanner.c
index dd596c9ee3..f97bb404c0 100644
--- a/source4/torture/basic/scanner.c
+++ b/source4/torture/basic/scanner.c
@@ -515,7 +515,7 @@ bool torture_smb_scan(struct torture_context *torture)
for (op=0x0;op<=0xFF;op++) {
if (op == SMBreadbraw) continue;
- if (!torture_open_connection(&cli, 0)) {
+ if (!torture_open_connection(&cli, torture, 0)) {
return false;
}
diff --git a/source4/torture/nbench/nbench.c b/source4/torture/nbench/nbench.c
index ddedd102f9..e9bd32cce0 100644
--- a/source4/torture/nbench/nbench.c
+++ b/source4/torture/nbench/nbench.c
@@ -39,14 +39,14 @@ static int read_only;
static unsigned long nb_max_retries;
#define NB_RETRY(op) \
- for (n=0;n<=nb_max_retries && !op;n++) do_reconnect(&cli, client)
+ for (n=0;n<=nb_max_retries && !op;n++) do_reconnect(&cli, tctx, client)
-static void do_reconnect(struct smbcli_state **cli, int client)
+static void do_reconnect(struct smbcli_state **cli, struct torture_context *tctx, int client)
{
int n;
printf("[%d] Reconnecting client %d\n", nbench_line_count, client);
for (n=0;n<nb_max_retries;n++) {
- if (nb_reconnect(cli, client)) {
+ if (nb_reconnect(cli, tctx, client)) {
printf("[%d] Reconnected client %d\n", nbench_line_count, client);
return;
}
@@ -244,7 +244,7 @@ bool torture_nbench(struct torture_context *torture)
}
if (torture_nprocs > 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;i<nprocs;i++) {
+ state[i].tctx = torture;
state[i].mem_ctx = talloc_new(state);
state[i].client_num = i;
state[i].ev = ev;
- if (!torture_open_connection_ev(&cli, i, ev)) {
+ if (!torture_open_connection_ev(&cli, i, torture, ev)) {
return false;
}
talloc_steal(mem_ctx, state);
diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c
index 8687e8e952..2967abdbe3 100644
--- a/source4/torture/raw/notify.c
+++ b/source4/torture/raw/notify.c
@@ -836,7 +836,7 @@ done:
/*
basic testing of change notifies followed by a tdis
*/
-static bool test_notify_tdis(TALLOC_CTX *mem_ctx)
+static bool test_notify_tdis(struct torture_context *tctx)
{
bool ret = true;
NTSTATUS status;
@@ -848,7 +848,7 @@ static bool test_notify_tdis(TALLOC_CTX *mem_ctx)
printf("TESTING CHANGE NOTIFY FOLLOWED BY TDIS\n");
- if (!torture_open_connection(&cli, 0)) {
+ if (!torture_open_connection(&cli, tctx, 0)) {
return false;
}
@@ -868,7 +868,7 @@ static bool test_notify_tdis(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;
@@ -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, &notify);
+ status = smb_raw_changenotify_recv(req, tctx, &notify);
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, &notify);
+ status = smb_raw_changenotify_recv(req, tctx, &notify);
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, &notify);
+ status = smb_raw_changenotify_recv(req, tctx, &notify);
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, &notify);
+ status = smb_raw_changenotify_recv(req, tctx, &notify);
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; i<num_files; i++) {
if (!torture_open_connection_share(mem_ctx, &(clients[i]),
- host, share, ev)) {
+ tctx, host, share, ev)) {
DEBUG(0, ("Could not open %d'th connection\n", i));
return false;
}
diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c
index a53efb3a8b..3eec9fbb13 100644
--- a/source4/torture/raw/openbench.c
+++ b/source4/torture/raw/openbench.c
@@ -42,6 +42,7 @@ static int num_connected;
static struct timed_event *report_te;
struct benchopen_state {
+ struct torture_context *tctx;
TALLOC_CTX *mem_ctx;
struct event_context *ev;
struct smbcli_state *cli;
@@ -116,7 +117,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);
}
@@ -358,10 +359,11 @@ bool torture_bench_open(struct torture_context *torture)
printf("Opening %d connections\n", nprocs);
for (i=0;i<nprocs;i++) {
+ state[i].tctx = torture;
state[i].mem_ctx = talloc_new(state);
state[i].client_num = i;
state[i].ev = ev;
- if (!torture_open_connection_ev(&state[i].cli, i, ev)) {
+ if (!torture_open_connection_ev(&state[i].cli, i, torture, ev)) {
return false;
}
talloc_steal(mem_ctx, state);
diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c
index e642c1846c..952088e46c 100644
--- a/source4/torture/raw/oplock.c
+++ b/source4/torture/raw/oplock.c
@@ -1325,7 +1325,7 @@ bool torture_bench_oplock(struct torture_context *torture)
torture_comment(torture, "Opening %d connections\n", torture_nprocs);
for (i=0;i<torture_nprocs;i++) {
- if (!torture_open_connection_ev(&cli[i], i, ev)) {
+ if (!torture_open_connection_ev(&cli[i], i, torture, ev)) {
return false;
}
talloc_steal(mem_ctx, cli[i]);
diff --git a/source4/torture/raw/pingpong.c b/source4/torture/raw/pingpong.c
index 3174021f7b..ca56f190a9 100755
--- a/source4/torture/raw/pingpong.c
+++ b/source4/torture/raw/pingpong.c
@@ -207,7 +207,7 @@ bool torture_ping_pong(struct torture_context *torture)
do_writes = torture_setting_bool(torture, "write", false);
lock_timeout = torture_setting_int(torture, "lock_timeout", 100000);
- if (!torture_open_connection(&cli, 0)) {
+ if (!torture_open_connection(&cli, torture, 0)) {
DEBUG(0,("Could not open connection\n"));
return false;
}
diff --git a/source4/torture/raw/samba3hide.c b/source4/torture/raw/samba3hide.c
index 8fe3aa4d2d..814b5f57f4 100644
--- a/source4/torture/raw/samba3hide.c
+++ b/source4/torture/raw/samba3hide.c
@@ -135,7 +135,7 @@ bool torture_samba3_hide(struct torture_context *torture)
struct smbcli_tree *hideunwrite;
if (!torture_open_connection_share(
- torture, &cli, torture_setting_string(torture, "host", NULL),
+ torture, &cli, torture, torture_setting_string(torture, "host", NULL),
torture_setting_string(torture, "share", NULL), NULL)) {
d_printf("torture_open_connection_share failed\n");
return false;
@@ -283,7 +283,7 @@ bool torture_samba3_closeerr(struct torture_context *tctx)
const char *fname = "closeerr.dir\\closerr.txt";
int fnum;
- if (!torture_open_connection(&cli, 0)) {
+ if (!torture_open_connection(&cli, tctx, 0)) {
goto fail;
}
diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c
index a075277efb..749b10cc07 100644
--- a/source4/torture/raw/samba3misc.c
+++ b/source4/torture/raw/samba3misc.c
@@ -54,7 +54,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture)
}
if (!torture_open_connection_share(
- torture, &cli, torture_setting_string(torture, "host", NULL),
+ torture, &cli, torture, torture_setting_string(torture, "host", NULL),
torture_setting_string(torture, "share", NULL), NULL)) {
d_printf("torture_open_connection_share failed\n");
ret = false;
@@ -351,7 +351,7 @@ bool torture_samba3_badpath(struct torture_context *torture)
goto fail;
}
- if (!torture_open_connection(&cli_nt, 0)) {
+ if (!torture_open_connection(&cli_nt, torture, 0)) {
goto fail;
}
@@ -360,7 +360,7 @@ bool torture_samba3_badpath(struct torture_context *torture)
goto fail;
}
- if (!torture_open_connection(&cli_dos, 1)) {
+ if (!torture_open_connection(&cli_dos, torture, 1)) {
goto fail;
}
@@ -626,7 +626,7 @@ bool torture_samba3_caseinsensitive(struct torture_context *torture)
return false;
}
- if (!torture_open_connection(&cli, 0)) {
+ if (!torture_open_connection(&cli, torture, 0)) {
goto done;
}
@@ -692,7 +692,7 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx)
struct smb_lock_entry lock_entry;
struct smbcli_request *req;
- if (!torture_open_connection(&cli, 0)) {
+ if (!torture_open_connection(&cli, tctx, 0)) {
ret = false;
goto done;
}
@@ -827,7 +827,7 @@ bool torture_samba3_rootdirfid(struct torture_context *tctx)
const char *fname = "testfile";
bool ret = false;
- if (!torture_open_connection(&cli, 0)) {
+ if (!torture_open_connection(&cli, tctx, 0)) {
ret = false;
goto done;
}
diff --git a/source4/torture/rpc/dfs.c b/source4/torture/rpc/dfs.c
index 2c68872a55..e169876b2b 100644
--- a/source4/torture/rpc/dfs.c
+++ b/source4/torture/rpc/dfs.c
@@ -115,13 +115,14 @@ static bool test_NetShareDel(TALLOC_CTX *mem_ctx,
static bool test_CreateDir(TALLOC_CTX *mem_ctx,
struct smbcli_state **cli,
+ struct torture_context *tctx,
const char *host,
const char *share,
const char *dir)
{
printf("Creating directory %s\n", dir);
- if (!torture_open_connection_share(mem_ctx, cli, host, share, NULL)) {
+ if (!torture_open_connection_share(mem_ctx, cli, tctx, host, share, NULL)) {
return false;
}
@@ -480,6 +481,7 @@ static bool test_AddStdRootForced(struct dcerpc_pipe *p,
static void test_cleanup_stdroot(struct dcerpc_pipe *p,
TALLOC_CTX *mem_ctx,
+ struct torture_context *tctx,
const char *host,
const char *sharename,
const char *dir)
@@ -490,13 +492,14 @@ static void test_cleanup_stdroot(struct dcerpc_pipe *p,
test_RemoveStdRoot(p, mem_ctx, host, sharename);
test_NetShareDel(mem_ctx, host, sharename);
- torture_open_connection_share(mem_ctx, &cli, host, "C$", NULL);
+ torture_open_connection_share(mem_ctx, &cli, tctx, host, "C$", NULL);
test_DeleteDir(cli, dir);
torture_close_connection(cli);
}
static bool test_StdRoot(struct dcerpc_pipe *p,
TALLOC_CTX *mem_ctx,
+ struct torture_context *tctx,
const char *host)
{
const char *sharename = SMBTORTURE_DFS_SHARENAME;
@@ -507,9 +510,9 @@ static bool test_StdRoot(struct dcerpc_pipe *p,
printf("Testing StdRoot\n");
- test_cleanup_stdroot(p, mem_ctx, host, sharename, dir);
+ test_cleanup_stdroot(p, mem_ctx, tctx, host, sharename, dir);
- ret &= test_CreateDir(mem_ctx, &cli, host, "C$", dir);
+ ret &= test_CreateDir(mem_ctx, &cli, tctx, host, "C$", dir);
ret &= test_NetShareAdd(mem_ctx, host, sharename, path);
ret &= test_AddStdRoot(p, mem_ctx, host, sharename);
ret &= test_RemoveStdRoot(p, mem_ctx, host, sharename);
@@ -652,7 +655,7 @@ bool torture_rpc_dfs(struct torture_context *torture)
ret &= test_ManagerInitialize(p, torture, host);
ret &= test_Enum(p, torture);
ret &= test_EnumEx(p, torture, host);
- ret &= test_StdRoot(p, torture, host);
+ ret &= test_StdRoot(p, torture, torture, host);
ret &= test_FtRoot(p, torture, host);
ret &= test_DcAddress(p, torture, host);
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 941c7b4f74..522b821b91 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -1840,7 +1840,7 @@ bool torture_samba3_rpc_srvsvc(struct torture_context *torture)
}
if (!(torture_open_connection_share(
- mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
+ mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL),
"IPC$", NULL))) {
talloc_free(mem_ctx);
return false;
@@ -1902,7 +1902,7 @@ bool torture_samba3_rpc_randomauth2(struct torture_context *torture)
if (!(torture_open_connection_share(
mem_ctx, &cli,
- torture_setting_string(torture, "host", NULL),
+ torture, torture_setting_string(torture, "host", NULL),
"IPC$", NULL))) {
d_printf("IPC$ connection failed\n");
goto done;
@@ -2193,7 +2193,7 @@ bool torture_samba3_rpc_sharesec(struct torture_context *torture)
}
if (!(torture_open_connection_share(
- mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
+ mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL),
"IPC$", NULL))) {
d_printf("IPC$ connection failed\n");
talloc_free(mem_ctx);
@@ -2241,7 +2241,7 @@ bool torture_samba3_rpc_lsa(struct torture_context *torture)
}
if (!(torture_open_connection_share(
- mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
+ mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL),
"IPC$", NULL))) {
d_printf("IPC$ connection failed\n");
talloc_free(mem_ctx);
@@ -2519,7 +2519,7 @@ bool torture_samba3_rpc_spoolss(struct torture_context *torture)
}
if (!(torture_open_connection_share(
- mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
+ mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL),
"IPC$", NULL))) {
d_printf("IPC$ connection failed\n");
talloc_free(mem_ctx);
@@ -2705,7 +2705,7 @@ bool torture_samba3_rpc_wkssvc(struct torture_context *torture)
}
if (!(torture_open_connection_share(
- mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
+ mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL),
"IPC$", NULL))) {
d_printf("IPC$ connection failed\n");
talloc_free(mem_ctx);
@@ -3255,7 +3255,7 @@ bool torture_samba3_regconfig(struct torture_context *torture)
bool ret = false;
const char *comment = "Dummer Kommentar";
- if (!(torture_open_connection(&cli, 0))) {
+ if (!(torture_open_connection(&cli, torture, 0))) {
return false;
}
diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c
index 965b5543b0..6e6acf220f 100644
--- a/source4/torture/util_smb.c
+++ b/source4/torture/util_smb.c
@@ -465,6 +465,7 @@ NTSTATUS torture_check_ea(struct smbcli_state *cli,
_PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx,
struct smbcli_state **c,
+ struct torture_context *tctx,
const char *hostname,
const char *sharename,
struct event_context *ev)
@@ -479,26 +480,25 @@ _PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx,
return false;
}
- (*c)->transport->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(&current_cli, i)) {
+ if (torture_open_connection(&current_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");
}