From bbdfbf8d9d486aee51117976b8f825759a4c4a37 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 00:28:22 +0100 Subject: r26238: Add a loadparm context parameter to torture_context, remove more uses of global_loadparm. (This used to be commit a33a5530545086b81a3b205aa109dff11c546926) --- source4/torture/raw/composite.c | 74 ++++++++-------- source4/torture/raw/context.c | 98 ++++++++++----------- source4/torture/raw/eas.c | 22 ++--- source4/torture/raw/lock.c | 6 +- source4/torture/raw/lockbench.c | 2 +- source4/torture/raw/mkdir.c | 16 ++-- source4/torture/raw/notify.c | 22 ++--- source4/torture/raw/open.c | 180 +++++++++++++++++++-------------------- source4/torture/raw/pingpong.c | 10 +-- source4/torture/raw/read.c | 6 +- source4/torture/raw/samba3misc.c | 8 +- source4/torture/raw/unlink.c | 10 +-- 12 files changed, 225 insertions(+), 229 deletions(-) (limited to 'source4/torture/raw') diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c index c6969574a8..5a663fb565 100644 --- a/source4/torture/raw/composite.c +++ b/source4/torture/raw/composite.c @@ -43,7 +43,7 @@ static void loadfile_complete(struct composite_context *c) /* test a simple savefile/loadfile combination */ -static bool test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_loadfile(struct smbcli_state *cli, struct torture_context *tctx) { const char *fname = BASEDIR "\\test.txt"; NTSTATUS status; @@ -54,9 +54,9 @@ static bool test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) size_t len = random() % 100000; const int num_ops = 50; int i; - int *count = talloc_zero(mem_ctx, int); + int *count = talloc_zero(tctx, int); - data = talloc_array(mem_ctx, uint8_t, len); + data = talloc_array(tctx, uint8_t, len); generate_random_buffer(data, len); @@ -76,7 +76,7 @@ static bool test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("testing parallel loadfile with %d ops\n", num_ops); - c = talloc_array(mem_ctx, struct composite_context *, num_ops); + c = talloc_array(tctx, struct composite_context *, num_ops); for (i=0;itree, &io2); @@ -87,7 +87,7 @@ static bool test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("waiting for completion\n"); while (*count != num_ops) { event_loop_once(cli->transport->socket->event.ctx); - if (lp_parm_bool(global_loadparm, NULL, "torture", "progress", true)) { + if (torture_setting_bool(tctx, "progress", true)) { printf("(%s) count=%d\r", __location__, *count); fflush(stdout); } @@ -95,7 +95,7 @@ static bool test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("count=%d\n", *count); for (i=0;ilp_ctx); io2.in.filename = fname; printf("testing parallel fetchfile with %d ops\n", torture_numops); event_ctx = cli->transport->socket->event.ctx; - c = talloc_array(mem_ctx, struct composite_context *, torture_numops); + c = talloc_array(tctx, struct composite_context *, torture_numops); for (i=0; itype = SEC_ACE_TYPE_ACCESS_ALLOWED; ace->flags = 0; @@ -280,8 +280,8 @@ static bool test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("testing parallel appendacl with %d ops\n", num_ops); - c = talloc_array(mem_ctx, struct composite_context *, num_ops); - io = talloc_array(mem_ctx, struct smb_composite_appendacl *, num_ops); + c = talloc_array(tctx, struct composite_context *, num_ops); + io = talloc_array(tctx, struct smb_composite_appendacl *, num_ops); for (i=0; i < num_ops; i++) { io[i] = talloc (io, struct smb_composite_appendacl); @@ -293,11 +293,11 @@ static bool test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) c[i]->async.private_data = count; } - event_ctx = talloc_reference(mem_ctx, cli->tree->session->transport->socket->event.ctx); + event_ctx = talloc_reference(tctx, cli->tree->session->transport->socket->event.ctx); printf("waiting for completion\n"); while (*count != num_ops) { event_loop_once(event_ctx); - if (lp_parm_bool(global_loadparm, NULL, "torture", "progress", true)) { + if (torture_setting_bool(tctx, "progress", true)) { printf("(%s) count=%d\r", __location__, *count); fflush(stdout); } @@ -327,7 +327,7 @@ static bool test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) } /* test a query FS info by asking for share's GUID */ -static bool test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_fsinfo(struct smbcli_state *cli, struct torture_context *tctx) { char *guid = NULL; NTSTATUS status; @@ -337,22 +337,22 @@ static bool test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) int i; extern int torture_numops; struct event_context *event_ctx; - int *count = talloc_zero(mem_ctx, int); + int *count = talloc_zero(tctx, int); bool ret = true; - io1.in.dest_host = lp_parm_string(global_loadparm, NULL, "torture", "host"); + io1.in.dest_host = torture_setting_string(tctx, "host", NULL); io1.in.port = 0; - io1.in.called_name = lp_parm_string(global_loadparm, NULL, "torture", "host"); - io1.in.service = lp_parm_string(global_loadparm, NULL, "torture", "share"); + io1.in.called_name = torture_setting_string(tctx, "host", NULL); + io1.in.service = torture_setting_string(tctx, "share", NULL); io1.in.service_type = "A:"; io1.in.credentials = cmdline_credentials; - io1.in.workgroup = lp_workgroup(global_loadparm); + io1.in.workgroup = lp_workgroup(tctx->lp_ctx); io1.in.level = RAW_QFS_OBJECTID_INFORMATION; printf("testing parallel queryfsinfo [Object ID] with %d ops\n", torture_numops); - event_ctx = talloc_reference(mem_ctx, cli->tree->session->transport->socket->event.ctx); - c = talloc_array(mem_ctx, struct composite_context *, torture_numops); + event_ctx = talloc_reference(tctx, cli->tree->session->transport->socket->event.ctx); + c = talloc_array(tctx, struct composite_context *, torture_numops); for (i=0; itree,&io1); @@ -364,7 +364,7 @@ static bool test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) while (*count < torture_numops) { event_loop_once(event_ctx); - if (lp_parm_bool(global_loadparm, NULL, "torture", "progress", true)) { + if (torture_setting_bool(tctx, "progress", true)) { printf("(%s) count=%d\r", __location__, *count); fflush(stdout); } @@ -372,7 +372,7 @@ static bool test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("count=%d\n", *count); for (i=0;iobjectid_information.out.guid); + guid=GUID_string(tctx, &io1.out.fsinfo->objectid_information.out.guid); printf("[%d] GUID: %s\n", i, guid); diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c index 11ad11ab3f..20135d2fa9 100644 --- a/source4/torture/raw/context.c +++ b/source4/torture/raw/context.c @@ -59,7 +59,7 @@ /* test session ops */ -static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_session(struct smbcli_state *cli, struct torture_context *tctx) { NTSTATUS status; bool ret = true; @@ -88,11 +88,11 @@ static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) } printf("create a second security context on the same transport\n"); - session = smbcli_session_init(cli->transport, mem_ctx, false); + session = smbcli_session_init(cli->transport, tctx, false); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */ - setup.in.workgroup = lp_workgroup(global_loadparm); + setup.in.workgroup = lp_workgroup(tctx->lp_ctx); setup.in.credentials = cmdline_credentials; @@ -102,12 +102,12 @@ static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) session->vuid = setup.out.vuid; printf("create a third security context on the same transport, with vuid set\n"); - session2 = smbcli_session_init(cli->transport, mem_ctx, false); + session2 = smbcli_session_init(cli->transport, tctx, false); session2->vuid = session->vuid; setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */ - setup.in.workgroup = lp_workgroup(global_loadparm); + setup.in.workgroup = lp_workgroup(tctx->lp_ctx); setup.in.credentials = cmdline_credentials; @@ -129,12 +129,12 @@ static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) if (cli->transport->negotiate.capabilities & CAP_EXTENDED_SECURITY) { printf("create a fourth security context on the same transport, without extended security\n"); - session3 = smbcli_session_init(cli->transport, mem_ctx, false); + session3 = smbcli_session_init(cli->transport, tctx, false); session3->vuid = session->vuid; setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities &= ~CAP_EXTENDED_SECURITY; /* force a non extended security login (should fail) */ - setup.in.workgroup = lp_workgroup(global_loadparm); + setup.in.workgroup = lp_workgroup(tctx->lp_ctx); setup.in.credentials = cmdline_credentials; @@ -143,15 +143,15 @@ static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) CHECK_STATUS(status, NT_STATUS_LOGON_FAILURE); printf("create a fouth anonymous security context on the same transport, without extended security\n"); - session4 = smbcli_session_init(cli->transport, mem_ctx, false); + session4 = smbcli_session_init(cli->transport, tctx, false); session4->vuid = session->vuid; setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities &= ~CAP_EXTENDED_SECURITY; /* force a non extended security login (should fail) */ - setup.in.workgroup = lp_workgroup(global_loadparm); + setup.in.workgroup = lp_workgroup(tctx->lp_ctx); - anon_creds = cli_credentials_init(mem_ctx); - cli_credentials_set_conf(anon_creds, global_loadparm); + anon_creds = cli_credentials_init(tctx); + cli_credentials_set_conf(anon_creds, tctx->lp_ctx); cli_credentials_set_anonymous(anon_creds); setup.in.credentials = anon_creds; @@ -163,7 +163,7 @@ static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) } printf("use the same tree as the existing connection\n"); - tree = smbcli_tree_init(session, mem_ctx, false); + tree = smbcli_tree_init(session, tctx, false); tree->tid = cli->tree->tid; printf("create a file using the new vuid\n"); @@ -179,7 +179,7 @@ static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; io.ntcreatex.in.fname = fname; - status = smb_raw_open(tree, mem_ctx, &io); + status = smb_raw_open(tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); fnum = io.ntcreatex.out.file.fnum; @@ -225,11 +225,11 @@ static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) for (i=0; i transport->negotiate.sesskey; setups[i].in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */ - setups[i].in.workgroup = lp_workgroup(global_loadparm); + setups[i].in.workgroup = lp_workgroup(tctx->lp_ctx); setups[i].in.credentials = cmdline_credentials; - sessions[i] = smbcli_session_init(cli->transport, mem_ctx, false); + sessions[i] = smbcli_session_init(cli->transport, tctx, false); composite_contexts[i] = smb_composite_sesssetup_send(sessions[i], &setups[i]); } @@ -257,7 +257,7 @@ done: /* test tree ops */ -static bool test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_tree(struct smbcli_state *cli, struct torture_context *tctx) { NTSTATUS status; bool ret = true; @@ -277,18 +277,18 @@ static bool test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return false; } - share = lp_parm_string(global_loadparm, NULL, "torture", "share"); - host = lp_parm_string(global_loadparm, NULL, "torture", "host"); + share = torture_setting_string(tctx, "share", NULL); + host = torture_setting_string(tctx, "host", NULL); printf("create a second tree context on the same session\n"); - tree = smbcli_tree_init(cli->session, mem_ctx, false); + tree = smbcli_tree_init(cli->session, tctx, false); tcon.generic.level = RAW_TCON_TCONX; tcon.tconx.in.flags = 0; tcon.tconx.in.password = data_blob(NULL, 0); - tcon.tconx.in.path = talloc_asprintf(mem_ctx, "\\\\%s\\%s", host, share); + tcon.tconx.in.path = talloc_asprintf(tctx, "\\\\%s\\%s", host, share); tcon.tconx.in.device = "A:"; - status = smb_raw_tcon(tree, mem_ctx, &tcon); + status = smb_raw_tcon(tree, tctx, &tcon); CHECK_STATUS(status, NT_STATUS_OK); @@ -297,7 +297,7 @@ static bool test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("try a tconx with a bad device type\n"); tcon.tconx.in.device = "FOO"; - status = smb_raw_tcon(tree, mem_ctx, &tcon); + status = smb_raw_tcon(tree, tctx, &tcon); CHECK_STATUS(status, NT_STATUS_BAD_DEVICE_TYPE); @@ -314,7 +314,7 @@ static bool test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; io.ntcreatex.in.fname = fname; - status = smb_raw_open(tree, mem_ctx, &io); + status = smb_raw_open(tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); fnum = io.ntcreatex.out.file.fnum; @@ -362,7 +362,7 @@ done: this demonstrates that a tcon isn't autoclosed by a ulogoff the tcon can be reused using any other valid session later */ -static bool test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_tree_ulogoff(struct smbcli_state *cli, struct torture_context *tctx) { NTSTATUS status; bool ret = true; @@ -385,14 +385,14 @@ static bool test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return false; } - share = lp_parm_string(global_loadparm, NULL, "torture", "share"); - host = lp_parm_string(global_loadparm, NULL, "torture", "host"); + share = torture_setting_string(tctx, "share", NULL); + host = torture_setting_string(tctx, "host", NULL); printf("create the first new sessions\n"); - session1 = smbcli_session_init(cli->transport, mem_ctx, false); + session1 = smbcli_session_init(cli->transport, tctx, false); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; - setup.in.workgroup = lp_workgroup(global_loadparm); + setup.in.workgroup = lp_workgroup(tctx->lp_ctx); setup.in.credentials = cmdline_credentials; status = smb_composite_sesssetup(session1, &setup); CHECK_STATUS(status, NT_STATUS_OK); @@ -400,13 +400,13 @@ static bool test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("vuid1=%d\n", session1->vuid); printf("create a tree context on the with vuid1\n"); - tree = smbcli_tree_init(session1, mem_ctx, false); + tree = smbcli_tree_init(session1, tctx, false); tcon.generic.level = RAW_TCON_TCONX; tcon.tconx.in.flags = 0; tcon.tconx.in.password = data_blob(NULL, 0); - tcon.tconx.in.path = talloc_asprintf(mem_ctx, "\\\\%s\\%s", host, share); + tcon.tconx.in.path = talloc_asprintf(tctx, "\\\\%s\\%s", host, share); tcon.tconx.in.device = "A:"; - status = smb_raw_tcon(tree, mem_ctx, &tcon); + status = smb_raw_tcon(tree, tctx, &tcon); CHECK_STATUS(status, NT_STATUS_OK); tree->tid = tcon.tconx.out.tid; printf("tid=%d\n", tree->tid); @@ -424,7 +424,7 @@ static bool test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; io.ntcreatex.in.fname = fname1; - status = smb_raw_open(tree, mem_ctx, &io); + status = smb_raw_open(tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); fnum1 = io.ntcreatex.out.file.fnum; @@ -445,10 +445,10 @@ static bool test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) CHECK_STATUS(status, NT_STATUS_OK); printf("create the second new sessions\n"); - session2 = smbcli_session_init(cli->transport, mem_ctx, false); + session2 = smbcli_session_init(cli->transport, tctx, false); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; - setup.in.workgroup = lp_workgroup(global_loadparm); + setup.in.workgroup = lp_workgroup(tctx->lp_ctx); setup.in.credentials = cmdline_credentials; status = smb_composite_sesssetup(session2, &setup); CHECK_STATUS(status, NT_STATUS_OK); @@ -471,7 +471,7 @@ static bool test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; io.ntcreatex.in.fname = fname2; - status = smb_raw_open(tree, mem_ctx, &io); + status = smb_raw_open(tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); fnum2 = io.ntcreatex.out.file.fnum; @@ -620,7 +620,7 @@ done: /* test pid ops with 2 sessions */ -static bool test_pid_2sess(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_pid_2sess(struct smbcli_state *cli, struct torture_context *tctx) { NTSTATUS status; bool ret = true; @@ -641,11 +641,11 @@ static bool test_pid_2sess(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) } printf("create a second security context on the same transport\n"); - session = smbcli_session_init(cli->transport, mem_ctx, false); + session = smbcli_session_init(cli->transport, tctx, false); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */ - setup.in.workgroup = lp_workgroup(global_loadparm); + setup.in.workgroup = lp_workgroup(tctx->lp_ctx); setup.in.credentials = cmdline_credentials; @@ -672,7 +672,7 @@ static bool test_pid_2sess(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; io.ntcreatex.in.fname = fname; - 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; @@ -724,7 +724,7 @@ done: /* test pid ops with 2 tcons */ -static bool test_pid_2tcon(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_pid_2tcon(struct smbcli_state *cli, struct torture_context *tctx) { NTSTATUS status; bool ret = true; @@ -746,18 +746,18 @@ static bool test_pid_2tcon(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return false; } - share = lp_parm_string(global_loadparm, NULL, "torture", "share"); - host = lp_parm_string(global_loadparm, NULL, "torture", "host"); + share = torture_setting_string(tctx, "share", NULL); + host = torture_setting_string(tctx, "host", NULL); printf("create a second tree context on the same session\n"); - tree = smbcli_tree_init(cli->session, mem_ctx, false); + tree = smbcli_tree_init(cli->session, tctx, false); tcon.generic.level = RAW_TCON_TCONX; tcon.tconx.in.flags = 0; tcon.tconx.in.password = data_blob(NULL, 0); - tcon.tconx.in.path = talloc_asprintf(mem_ctx, "\\\\%s\\%s", host, share); + tcon.tconx.in.path = talloc_asprintf(tctx, "\\\\%s\\%s", host, share); tcon.tconx.in.device = "A:"; - status = smb_raw_tcon(tree, mem_ctx, &tcon); + status = smb_raw_tcon(tree, tctx, &tcon); CHECK_STATUS(status, NT_STATUS_OK); tree->tid = tcon.tconx.out.tid; @@ -780,7 +780,7 @@ static bool test_pid_2tcon(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; io.ntcreatex.in.fname = fname1; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); fnum1 = io.ntcreatex.out.file.fnum; @@ -811,7 +811,7 @@ static bool test_pid_2tcon(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; io.ntcreatex.in.fname = fname2; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); fnum2 = io.ntcreatex.out.file.fnum; @@ -890,9 +890,9 @@ bool torture_raw_context(struct torture_context *torture, struct smbcli_state *cli) { bool ret = true; - if (lp_use_spnego(global_loadparm)) { + if (lp_use_spnego(torture->lp_ctx)) { ret &= torture_raw_context_int(torture, cli); - lp_set_cmdline(global_loadparm, "use spnego", "False"); + lp_set_cmdline(torture->lp_ctx, "use spnego", "False"); } ret &= torture_raw_context_int(torture, cli); diff --git a/source4/torture/raw/eas.c b/source4/torture/raw/eas.c index b24b98796f..53449a1505 100644 --- a/source4/torture/raw/eas.c +++ b/source4/torture/raw/eas.c @@ -229,7 +229,7 @@ static int test_one_eamax(struct smbcli_state *cli, const int fnum, * --option torture:maxeasize=1024 --option torture:maxeadebug=1 ... * */ -static bool test_max_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_max_eas(struct smbcli_state *cli, struct torture_context *tctx) { NTSTATUS status; union smb_open io; @@ -247,10 +247,10 @@ static bool test_max_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("TESTING SETFILEINFO MAX. EA_SET\n"); - maxeasize = lp_parm_int(global_loadparm, NULL, "torture", "maxeasize", 65536); - maxeanames = lp_parm_int(global_loadparm, NULL, "torture", "maxeanames", 101); - maxeastart = lp_parm_int(global_loadparm, NULL, "torture", "maxeastart", 1); - maxeadebug = lp_parm_int(global_loadparm, NULL, "torture", "maxeadebug", 0); + maxeasize = torture_setting_int(tctx, "maxeasize", 65536); + maxeanames = torture_setting_int(tctx, "maxeanames", 101); + maxeastart = torture_setting_int(tctx, "maxeastart", 1); + maxeadebug = torture_setting_int(tctx, "maxeadebug", 0); /* Do some sanity check on possibly passed parms */ if (maxeasize <= 0) { @@ -296,11 +296,11 @@ static bool test_max_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; io.ntcreatex.in.fname = fname; - 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; - eablob = data_blob_talloc(mem_ctx, NULL, maxeasize); + eablob = data_blob_talloc(tctx, NULL, maxeasize); if (eablob.data == NULL) { goto done; } @@ -336,7 +336,7 @@ static bool test_max_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) if (eaname != NULL) { talloc_free(eaname); } - eaname = talloc_asprintf(mem_ctx, "MAX%d", i); + eaname = talloc_asprintf(tctx, "MAX%d", i); if(eaname == NULL) { goto done; } @@ -468,19 +468,16 @@ bool torture_max_eas(struct torture_context *torture) { struct smbcli_state *cli; bool ret = true; - TALLOC_CTX *mem_ctx; if (!torture_open_connection(&cli, 0)) { return false; } - mem_ctx = talloc_init("torture_raw_eas"); - if (!torture_setup_dir(cli, BASEDIR)) { return false; } - ret &= test_max_eas(cli, mem_ctx); + ret &= test_max_eas(cli, torture); smb_raw_exit(cli->session); if (!maxeadebug) { @@ -489,6 +486,5 @@ bool torture_max_eas(struct torture_context *torture) } torture_close_connection(cli); - talloc_free(mem_ctx); return ret; } diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c index c2d5a778fb..6eb43bd538 100644 --- a/source4/torture/raw/lock.c +++ b/source4/torture/raw/lock.c @@ -592,15 +592,15 @@ static bool test_async(struct torture_context *tctx, session = smbcli_session_init(cli->transport, tctx, false); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; - setup.in.workgroup = lp_workgroup(global_loadparm); + setup.in.workgroup = lp_workgroup(tctx->lp_ctx); setup.in.credentials = cmdline_credentials; status = smb_composite_sesssetup(session, &setup); CHECK_STATUS(status, NT_STATUS_OK); session->vuid = setup.out.vuid; printf("create new tree context\n"); - share = lp_parm_string(global_loadparm, NULL, "torture", "share"); - host = lp_parm_string(global_loadparm, NULL, "torture", "host"); + share = torture_setting_string(tctx, "share", NULL); + host = torture_setting_string(tctx, "host", NULL); tree = smbcli_tree_init(session, tctx, false); tcon.generic.level = RAW_TCON_TCONX; tcon.tconx.in.flags = 0; diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 855364b169..633264ce0a 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -318,7 +318,7 @@ bool torture_bench_lock(struct torture_context *torture) progress = torture_setting_bool(torture, "progress", true); - nprocs = lp_parm_int(global_loadparm, NULL, "torture", "nprocs", 4); + nprocs = torture_setting_int(torture, "nprocs", 4); state = talloc_zero_array(mem_ctx, struct benchlock_state, nprocs); diff --git a/source4/torture/raw/mkdir.c b/source4/torture/raw/mkdir.c index f502b10a69..93e94150d7 100644 --- a/source4/torture/raw/mkdir.c +++ b/source4/torture/raw/mkdir.c @@ -37,7 +37,7 @@ /* test mkdir ops */ -static bool test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_mkdir(struct smbcli_state *cli, struct torture_context *tctx) { union smb_mkdir md; struct smb_rmdir rd; @@ -75,7 +75,7 @@ static bool test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("testing mkdir collision with file\n"); /* name collision with a file */ - smbcli_close(cli->tree, create_complex_file(cli, mem_ctx, path)); + smbcli_close(cli->tree, create_complex_file(cli, tctx, path)); status = smb_raw_mkdir(cli->tree, &md); CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION); @@ -107,7 +107,7 @@ static bool test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) CHECK_STATUS(status, NT_STATUS_OK); printf("testing t2mkdir bad path\n"); - md.t2mkdir.in.path = talloc_asprintf(mem_ctx, "%s\\bad_path\\bad_path", + md.t2mkdir.in.path = talloc_asprintf(tctx, "%s\\bad_path\\bad_path", BASEDIR); status = smb_raw_mkdir(cli->tree, &md); CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); @@ -118,19 +118,19 @@ static bool test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) md.t2mkdir.level = RAW_MKDIR_T2MKDIR; md.t2mkdir.in.path = path; md.t2mkdir.in.num_eas = 3; - md.t2mkdir.in.eas = talloc_array(mem_ctx, struct ea_struct, md.t2mkdir.in.num_eas); + md.t2mkdir.in.eas = talloc_array(tctx, struct ea_struct, md.t2mkdir.in.num_eas); md.t2mkdir.in.eas[0].flags = 0; md.t2mkdir.in.eas[0].name.s = "EAONE"; - md.t2mkdir.in.eas[0].value = data_blob_talloc(mem_ctx, "blah", 4); + md.t2mkdir.in.eas[0].value = data_blob_talloc(tctx, "blah", 4); md.t2mkdir.in.eas[1].flags = 0; md.t2mkdir.in.eas[1].name.s = "EA TWO"; - md.t2mkdir.in.eas[1].value = data_blob_talloc(mem_ctx, "foo bar", 7); + md.t2mkdir.in.eas[1].value = data_blob_talloc(tctx, "foo bar", 7); md.t2mkdir.in.eas[2].flags = 0; md.t2mkdir.in.eas[2].name.s = "EATHREE"; - md.t2mkdir.in.eas[2].value = data_blob_talloc(mem_ctx, "xx1", 3); + md.t2mkdir.in.eas[2].value = data_blob_talloc(tctx, "xx1", 3); status = smb_raw_mkdir(cli->tree, &md); - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false) + if (torture_setting_bool(tctx, "samba3", false) && NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED)) { d_printf("EAS not supported -- not treating as fatal\n"); } diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c index 96c7e4f947..8687e8e952 100644 --- a/source4/torture/raw/notify.c +++ b/source4/torture/raw/notify.c @@ -544,7 +544,7 @@ done: /* testing of mask bits for change notify */ -static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_notify_mask(struct smbcli_state *cli, struct torture_context *tctx) { bool ret = true; NTSTATUS status; @@ -585,7 +585,7 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) #define NOTIFY_MASK_TEST(setup, op, cleanup, Action, expected, nchanges) \ do { for (mask=i=0;i<32;i++) { \ struct smbcli_request *req; \ - 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; \ setup \ @@ -594,7 +594,7 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) req = smb_raw_changenotify_send(cli->tree, ¬ify); \ op \ msleep(200); smb_raw_ntcancel(req); \ - status = smb_raw_changenotify_recv(req, mem_ctx, ¬ify); \ + status = smb_raw_changenotify_recv(req, tctx, ¬ify); \ cleanup \ smbcli_close(cli->tree, fnum); \ if (NT_STATUS_EQUAL(status, NT_STATUS_CANCELLED)) continue; \ @@ -705,20 +705,20 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("testing set file attribute\n"); NOTIFY_MASK_TEST( - fnum2 = create_complex_file(cli, mem_ctx, BASEDIR "\\tname1");, + fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");, smbcli_fsetatr(cli->tree, fnum2, FILE_ATTRIBUTE_HIDDEN, 0, 0, 0, 0);, (smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));, NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_ATTRIBUTES, 1); - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) { + if (torture_setting_bool(tctx, "samba3", false)) { printf("Samba3 does not yet support create times " "everywhere\n"); } else { printf("testing set file create time\n"); NOTIFY_MASK_TEST( - fnum2 = create_complex_file(cli, mem_ctx, + fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");, smbcli_fsetatr(cli->tree, fnum2, 0, t, 0, 0, 0);, (smbcli_close(cli->tree, fnum2), @@ -729,7 +729,7 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("testing set file access time\n"); NOTIFY_MASK_TEST( - fnum2 = create_complex_file(cli, mem_ctx, BASEDIR "\\tname1");, + fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");, smbcli_fsetatr(cli->tree, fnum2, 0, 0, t, 0, 0);, (smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));, NOTIFY_ACTION_MODIFIED, @@ -737,7 +737,7 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("testing set file write time\n"); NOTIFY_MASK_TEST( - fnum2 = create_complex_file(cli, mem_ctx, BASEDIR "\\tname1");, + fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");, smbcli_fsetatr(cli->tree, fnum2, 0, 0, 0, t, 0);, (smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));, NOTIFY_ACTION_MODIFIED, @@ -745,7 +745,7 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("testing set file change time\n"); NOTIFY_MASK_TEST( - fnum2 = create_complex_file(cli, mem_ctx, BASEDIR "\\tname1");, + fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");, smbcli_fsetatr(cli->tree, fnum2, 0, 0, 0, 0, t);, (smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));, NOTIFY_ACTION_MODIFIED, @@ -754,7 +754,7 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("testing write\n"); NOTIFY_MASK_TEST( - fnum2 = create_complex_file(cli, mem_ctx, BASEDIR "\\tname1");, + fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");, smbcli_write(cli->tree, fnum2, 1, &c, 10000, 1);, (smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));, NOTIFY_ACTION_MODIFIED, @@ -762,7 +762,7 @@ static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("testing truncate\n"); NOTIFY_MASK_TEST( - fnum2 = create_complex_file(cli, mem_ctx, BASEDIR "\\tname1");, + fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");, smbcli_ftruncate(cli->tree, fnum2, 10000);, (smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));, NOTIFY_ACTION_MODIFIED, diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c index c4ccc0eb17..fb81f7d55c 100644 --- a/source4/torture/raw/open.c +++ b/source4/torture/raw/open.c @@ -72,7 +72,7 @@ static const char *rdwr_string(enum rdwr_mode m) }} while (0) #define CREATE_FILE do { \ - fnum = create_complex_file(cli, mem_ctx, fname); \ + fnum = create_complex_file(cli, tctx, fname); \ if (fnum == -1) { \ printf("(%s) Failed to create %s - %s\n", __location__, fname, smbcli_errstr(cli->tree)); \ ret = false; \ @@ -91,16 +91,16 @@ static const char *rdwr_string(enum rdwr_mode m) time_t t1, t2; \ finfo.all_info.level = RAW_FILEINFO_ALL_INFO; \ finfo.all_info.in.file.path = fname; \ - status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); \ + status = smb_raw_pathinfo(cli->tree, tctx, &finfo); \ CHECK_STATUS(status, NT_STATUS_OK); \ t1 = t & ~1; \ t2 = nt_time_to_unix(finfo.all_info.out.field) & ~1; \ if (abs(t1-t2) > 2) { \ printf("(%s) wrong time for field %s %s - %s\n", \ __location__, #field, \ - timestring(mem_ctx, t1), \ - timestring(mem_ctx, t2)); \ - dump_all_info(mem_ctx, &finfo); \ + timestring(tctx, t1), \ + timestring(tctx, t2)); \ + dump_all_info(tctx, &finfo); \ ret = false; \ }} while (0) @@ -108,27 +108,27 @@ static const char *rdwr_string(enum rdwr_mode m) NTTIME t2; \ finfo.all_info.level = RAW_FILEINFO_ALL_INFO; \ finfo.all_info.in.file.path = fname; \ - status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); \ + status = smb_raw_pathinfo(cli->tree, tctx, &finfo); \ CHECK_STATUS(status, NT_STATUS_OK); \ t2 = finfo.all_info.out.field; \ if (t != t2) { \ printf("(%s) wrong time for field %s %s - %s\n", \ __location__, #field, \ - nt_time_string(mem_ctx, t), \ - nt_time_string(mem_ctx, t2)); \ - dump_all_info(mem_ctx, &finfo); \ + nt_time_string(tctx, t), \ + nt_time_string(tctx, t2)); \ + dump_all_info(tctx, &finfo); \ ret = false; \ }} while (0) #define CHECK_ALL_INFO(v, field) do { \ finfo.all_info.level = RAW_FILEINFO_ALL_INFO; \ finfo.all_info.in.file.path = fname; \ - status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); \ + status = smb_raw_pathinfo(cli->tree, tctx, &finfo); \ CHECK_STATUS(status, NT_STATUS_OK); \ if ((v) != (finfo.all_info.out.field)) { \ printf("(%s) wrong value for field %s 0x%x - 0x%x\n", \ __location__, #field, (int)v, (int)(finfo.all_info.out.field)); \ - dump_all_info(mem_ctx, &finfo); \ + dump_all_info(tctx, &finfo); \ ret = false; \ }} while (0) @@ -154,7 +154,7 @@ static const char *rdwr_string(enum rdwr_mode m) /* test RAW_OPEN_OPEN */ -static bool test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_open(struct smbcli_state *cli, struct torture_context *tctx) { union smb_open io; union smb_fileinfo finfo; @@ -169,7 +169,7 @@ static bool test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.openold.in.fname = fname; io.openold.in.open_mode = OPEN_FLAGS_FCB; io.openold.in.search_attrs = 0; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND); fnum = io.openold.out.file.fnum; @@ -177,12 +177,12 @@ static bool test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) CREATE_FILE; smbcli_close(cli->tree, fnum); - 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.openold.out.file.fnum; CHECK_RDWR(fnum, RDWR_RDWR); - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); fnum2 = io.openold.out.file.fnum; CHECK_RDWR(fnum2, RDWR_RDWR); @@ -195,21 +195,21 @@ static bool test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.openold.in.search_attrs = 0; io.openold.in.open_mode = OPEN_FLAGS_OPEN_READ; - 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.openold.out.file.fnum; CHECK_RDWR(fnum, RDWR_RDONLY); smbcli_close(cli->tree, fnum); io.openold.in.open_mode = OPEN_FLAGS_OPEN_WRITE; - 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.openold.out.file.fnum; CHECK_RDWR(fnum, RDWR_WRONLY); smbcli_close(cli->tree, fnum); io.openold.in.open_mode = OPEN_FLAGS_OPEN_RDWR; - 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.openold.out.file.fnum; CHECK_RDWR(fnum, RDWR_RDWR); @@ -217,7 +217,7 @@ static bool test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* check the share modes roughly - not a complete matrix */ io.openold.in.open_mode = OPEN_FLAGS_OPEN_RDWR | OPEN_FLAGS_DENY_WRITE; - 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.openold.out.file.fnum; CHECK_RDWR(fnum, RDWR_RDWR); @@ -228,11 +228,11 @@ static bool test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) } io.openold.in.open_mode = OPEN_FLAGS_OPEN_RDWR | OPEN_FLAGS_DENY_NONE; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION); io.openold.in.open_mode = OPEN_FLAGS_OPEN_READ | OPEN_FLAGS_DENY_NONE; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); fnum2 = io.openold.out.file.fnum; CHECK_RDWR(fnum2, RDWR_RDONLY); @@ -245,7 +245,7 @@ static bool test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.openold.in.fname = fname; io.openold.in.search_attrs = 0; io.openold.in.open_mode = OPEN_FLAGS_OPEN_READ; - 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.openold.out.file.fnum; @@ -265,7 +265,7 @@ done: /* test RAW_OPEN_OPENX */ -static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_openx(struct smbcli_state *cli, struct torture_context *tctx) { union smb_open io; union smb_fileinfo finfo; @@ -311,7 +311,7 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* check all combinations of open_func */ for (i=0; itree)); ret = false; @@ -320,7 +320,7 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) smbcli_close(cli->tree, fnum); } io.openx.in.open_func = open_funcs[i].open_func; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); if (!NT_STATUS_EQUAL(status, open_funcs[i].correct_status)) { printf("(%s) incorrect status %s should be %s (i=%d with_file=%d open_func=0x%x)\n", __location__, nt_errstr(status), nt_errstr(open_funcs[i].correct_status), @@ -339,7 +339,7 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* check the basic return fields */ io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE; - 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.openx.out.file.fnum; @@ -356,7 +356,7 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) smbcli_unlink(cli->tree, fname); /* check the fields when the file already existed */ - fnum2 = create_complex_file(cli, mem_ctx, fname); + fnum2 = create_complex_file(cli, tctx, fname); if (fnum2 == -1) { ret = false; goto done; @@ -364,7 +364,7 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) smbcli_close(cli->tree, fnum2); io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN; - 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.openx.out.file.fnum; @@ -380,12 +380,12 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN, attrib); io.openx.in.search_attrs = FILE_ATTRIBUTE_HIDDEN; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); smbcli_close(cli->tree, io.openx.out.file.fnum); io.openx.in.search_attrs = 0; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); smbcli_close(cli->tree, io.openx.out.file.fnum); @@ -396,9 +396,9 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.openx.in.open_func = OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE; io.openx.in.search_attrs = 0; io.openx.in.file_attrs = FILE_ATTRIBUTE_SYSTEM; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) { + if (torture_setting_bool(tctx, "samba3", false)) { CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE, attrib & ~(FILE_ATTRIBUTE_NONINDEXED| FILE_ATTRIBUTE_SPARSE)); @@ -414,14 +414,14 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE; io.openx.in.file_attrs = 0; io.openx.in.open_mode = OPENX_MODE_ACCESS_RDWR | OPENX_MODE_DENY_ALL; - 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.openx.out.file.fnum; io.openx.in.timeout = 20000; tv = timeval_current(); io.openx.in.open_mode = OPENX_MODE_ACCESS_RDWR | OPENX_MODE_DENY_NONE; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION); if (timeval_elapsed(&tv) > 3.0) { printf("(%s) Incorrect timing in openx with timeout - waited %.2f seconds\n", @@ -441,27 +441,27 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.openx.in.write_time = 0; io.openx.in.size = 0; io.openx.in.timeout = 0; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); smbcli_close(cli->tree, io.openx.out.file.fnum); /* check the extended return flag */ io.openx.in.flags = OPENX_FLAGS_ADDITIONAL_INFO | OPENX_FLAGS_EXTENDED_RETURN; io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); CHECK_VAL(io.openx.out.access_mask, SEC_STD_ALL); smbcli_close(cli->tree, io.openx.out.file.fnum); io.openx.in.fname = "\\A.+,;=[].B"; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND); /* Check the mapping for open exec. */ /* First create an .exe file. */ smbcli_unlink(cli->tree, fname_exe); - fnum = create_complex_file(cli, mem_ctx, fname_exe); + fnum = create_complex_file(cli, tctx, fname_exe); smbcli_close(cli->tree, fnum); io.openx.level = RAW_OPEN_OPENX; @@ -473,7 +473,7 @@ static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.openx.in.write_time = 0; io.openx.in.size = 0; io.openx.in.timeout = 0; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); /* Can we read and write ? */ @@ -495,7 +495,7 @@ done: many thanks to kukks for a sniff showing how this works with os2->w2k */ -static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_t2open(struct smbcli_state *cli, struct torture_context *tctx) { union smb_open io; union smb_fileinfo finfo; @@ -525,7 +525,7 @@ static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, false, NT_STATUS_OK }, }; - fnum = create_complex_file(cli, mem_ctx, fname1); + fnum = create_complex_file(cli, tctx, fname1); if (fnum == -1) { d_printf("Failed to create file %s - %s\n", fname1, smbcli_errstr(cli->tree)); ret = false; @@ -546,16 +546,16 @@ static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.t2open.in.timeout = 0; io.t2open.in.num_eas = 3; - io.t2open.in.eas = talloc_array(mem_ctx, struct ea_struct, io.t2open.in.num_eas); + io.t2open.in.eas = talloc_array(tctx, struct ea_struct, io.t2open.in.num_eas); io.t2open.in.eas[0].flags = 0; io.t2open.in.eas[0].name.s = ".CLASSINFO"; - io.t2open.in.eas[0].value = data_blob_talloc(mem_ctx, "first value", 11); + io.t2open.in.eas[0].value = data_blob_talloc(tctx, "first value", 11); io.t2open.in.eas[1].flags = 0; io.t2open.in.eas[1].name.s = "EA TWO"; - io.t2open.in.eas[1].value = data_blob_talloc(mem_ctx, "foo", 3); + io.t2open.in.eas[1].value = data_blob_talloc(tctx, "foo", 3); io.t2open.in.eas[2].flags = 0; io.t2open.in.eas[2].name.s = "X THIRD"; - io.t2open.in.eas[2].value = data_blob_talloc(mem_ctx, "xy", 2); + io.t2open.in.eas[2].value = data_blob_talloc(tctx, "xy", 2); /* check all combinations of open_func */ for (i=0; itree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); if ((io.t2open.in.num_eas != 0) && NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED) - && lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) { + && torture_setting_bool(tctx, "samba3", false)) { printf("(%s) EAs not supported, not treating as fatal " "in Samba3 test\n", __location__); io.t2open.in.num_eas = 0; @@ -594,7 +594,7 @@ static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.t2open.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE; io.t2open.in.write_time = 0; io.t2open.in.fname = fname; - 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.t2open.out.file.fnum; @@ -624,11 +624,11 @@ static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) SET_ATTRIB(FILE_ATTRIBUTE_HIDDEN); CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN, attrib); - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); smbcli_close(cli->tree, io.t2open.out.file.fnum); - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); smbcli_close(cli->tree, io.t2open.out.file.fnum); @@ -638,7 +638,7 @@ static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* and check attrib on create */ io.t2open.in.open_func = OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE; io.t2open.in.file_attrs = FILE_ATTRIBUTE_SYSTEM; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); /* check timeout on create - win2003 ignores the timeout! */ @@ -646,7 +646,7 @@ static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.t2open.in.file_attrs = 0; io.t2open.in.timeout = 20000; io.t2open.in.open_mode = OPENX_MODE_ACCESS_RDWR | OPENX_MODE_DENY_ALL; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION); done: @@ -660,7 +660,7 @@ done: /* test RAW_OPEN_NTCREATEX */ -static bool test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_ntcreatex(struct smbcli_state *cli, struct torture_context *tctx) { union smb_open io; union smb_fileinfo finfo; @@ -719,7 +719,7 @@ static bool test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) smbcli_close(cli->tree, fnum); } io.ntcreatex.in.open_disposition = open_funcs[i].open_disp; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); if (!NT_STATUS_EQUAL(status, open_funcs[i].correct_status)) { printf("(%s) incorrect status %s should be %s (i=%d with_file=%d open_disp=%d)\n", __location__, nt_errstr(status), nt_errstr(open_funcs[i].correct_status), @@ -735,7 +735,7 @@ static bool test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* basic field testing */ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE; - 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; @@ -754,7 +754,7 @@ static bool test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* check fields when the file already existed */ smbcli_close(cli->tree, fnum); smbcli_unlink(cli->tree, fname); - fnum = create_complex_file(cli, mem_ctx, fname); + fnum = create_complex_file(cli, tctx, fname); if (fnum == -1) { ret = false; goto done; @@ -762,7 +762,7 @@ static bool test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) smbcli_close(cli->tree, fnum); io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; - 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; @@ -799,7 +799,7 @@ static bool test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY; io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE; - 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; @@ -833,7 +833,7 @@ done: /* test RAW_OPEN_NTTRANS_CREATE */ -static bool test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_nttrans_create(struct smbcli_state *cli, struct torture_context *tctx) { union smb_open io; union smb_fileinfo finfo; @@ -894,7 +894,7 @@ static bool test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) smbcli_close(cli->tree, fnum); } io.ntcreatex.in.open_disposition = open_funcs[i].open_disp; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); if (!NT_STATUS_EQUAL(status, open_funcs[i].correct_status)) { printf("(%s) incorrect status %s should be %s (i=%d with_file=%d open_disp=%d)\n", __location__, nt_errstr(status), nt_errstr(open_funcs[i].correct_status), @@ -910,7 +910,7 @@ static bool test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* basic field testing */ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE; - 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; @@ -929,7 +929,7 @@ static bool test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* check fields when the file already existed */ smbcli_close(cli->tree, fnum); smbcli_unlink(cli->tree, fname); - fnum = create_complex_file(cli, mem_ctx, fname); + fnum = create_complex_file(cli, tctx, fname); if (fnum == -1) { ret = false; goto done; @@ -937,7 +937,7 @@ static bool test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) smbcli_close(cli->tree, fnum); io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; - 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; @@ -974,7 +974,7 @@ static bool test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY; io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE; - 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; @@ -1012,7 +1012,7 @@ done: open_disposition==NTCREATEX_DISP_OVERWRITE_IF. Windows 2003 allows the second open. */ -static bool test_ntcreatex_brlocked(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_ntcreatex_brlocked(struct smbcli_state *cli, struct torture_context *tctx) { union smb_open io, io1; union smb_lock io2; @@ -1038,7 +1038,7 @@ static bool test_ntcreatex_brlocked(struct smbcli_state *cli, TALLOC_CTX *mem_ct NTCREATEX_SECURITY_ALL; io.ntcreatex.in.fname = fname; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); io2.lockx.level = RAW_LOCK_LOCKX; @@ -1069,7 +1069,7 @@ static bool test_ntcreatex_brlocked(struct smbcli_state *cli, TALLOC_CTX *mem_ct NTCREATEX_SECURITY_ALL; io1.ntcreatex.in.fname = fname; - status = smb_raw_open(cli->tree, mem_ctx, &io1); + status = smb_raw_open(cli->tree, tctx, &io1); CHECK_STATUS(status, NT_STATUS_OK); done: @@ -1082,7 +1082,7 @@ static bool test_ntcreatex_brlocked(struct smbcli_state *cli, TALLOC_CTX *mem_ct /* test RAW_OPEN_MKNEW */ -static bool test_mknew(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_mknew(struct smbcli_state *cli, struct torture_context *tctx) { union smb_open io; const char *fname = BASEDIR "\\torture_mknew.txt"; @@ -1098,11 +1098,11 @@ static bool test_mknew(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.mknew.in.attrib = 0; io.mknew.in.write_time = 0; io.mknew.in.fname = fname; - 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.mknew.out.file.fnum; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION); smbcli_close(cli->tree, fnum); @@ -1110,7 +1110,7 @@ static bool test_mknew(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* make sure write_time works */ io.mknew.in.write_time = basetime; - 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.mknew.out.file.fnum; CHECK_TIME(basetime, write_time); @@ -1120,7 +1120,7 @@ static bool test_mknew(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* make sure file_attrs works */ io.mknew.in.attrib = FILE_ATTRIBUTE_HIDDEN; - 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.mknew.out.file.fnum; CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE, @@ -1137,7 +1137,7 @@ done: /* test RAW_OPEN_CREATE */ -static bool test_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_create(struct smbcli_state *cli, struct torture_context *tctx) { union smb_open io; const char *fname = BASEDIR "\\torture_create.txt"; @@ -1153,11 +1153,11 @@ static bool test_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.create.in.attrib = 0; io.create.in.write_time = 0; io.create.in.fname = fname; - 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.create.out.file.fnum; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(cli->tree, tctx, &io); CHECK_STATUS(status, NT_STATUS_OK); smbcli_close(cli->tree, io.create.out.file.fnum); @@ -1166,7 +1166,7 @@ static bool test_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* make sure write_time works */ io.create.in.write_time = basetime; - 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.create.out.file.fnum; CHECK_TIME(basetime, write_time); @@ -1176,7 +1176,7 @@ static bool test_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* make sure file_attrs works */ io.create.in.attrib = FILE_ATTRIBUTE_HIDDEN; - 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.create.out.file.fnum; CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE, @@ -1193,7 +1193,7 @@ done: /* test RAW_OPEN_CTEMP */ -static bool test_ctemp(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_ctemp(struct smbcli_state *cli, TALLOC_CTX *tctx) { union smb_open io; NTSTATUS status; @@ -1209,7 +1209,7 @@ static bool test_ctemp(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.ctemp.in.attrib = FILE_ATTRIBUTE_HIDDEN; io.ctemp.in.write_time = basetime; io.ctemp.in.directory = 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.ctemp.out.file.fnum; @@ -1217,7 +1217,7 @@ static bool test_ctemp(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) finfo.generic.level = RAW_FILEINFO_NAME_INFO; finfo.generic.in.file.fnum = fnum; - status = smb_raw_fileinfo(cli->tree, mem_ctx, &finfo); + status = smb_raw_fileinfo(cli->tree, tctx, &finfo); CHECK_STATUS(status, NT_STATUS_OK); fname = finfo.name_info.out.fname.s; @@ -1236,7 +1236,7 @@ done: /* test chained RAW_OPEN_OPENX_READX */ -static bool test_chained(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_chained(struct smbcli_state *cli, TALLOC_CTX *tctx) { union smb_open io; const char *fname = BASEDIR "\\torture_chained.txt"; @@ -1249,7 +1249,7 @@ static bool test_chained(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("Checking RAW_OPEN_OPENX chained with READX\n"); smbcli_unlink(cli->tree, fname); - fnum = create_complex_file(cli, mem_ctx, fname); + fnum = create_complex_file(cli, tctx, fname); smbcli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf)); @@ -1272,7 +1272,7 @@ static bool test_chained(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.openxreadx.in.remaining = 0; io.openxreadx.out.data = (uint8_t *)buf2; - 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.openxreadx.out.file.fnum; @@ -1293,7 +1293,7 @@ done: NetApp filers are known to fail on this. */ -static bool test_no_leading_slash(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_no_leading_slash(struct smbcli_state *cli, TALLOC_CTX *tctx) { union smb_open io; const char *fname = BASEDIR "\\torture_no_leading_slash.txt"; @@ -1306,7 +1306,7 @@ static bool test_no_leading_slash(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) smbcli_unlink(cli->tree, fname); /* Create the file */ - fnum = create_complex_file(cli, mem_ctx, fname); + fnum = create_complex_file(cli, tctx, fname); smbcli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf)); smbcli_close(cli->tree, fnum); @@ -1322,7 +1322,7 @@ static bool test_no_leading_slash(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.openx.in.size = 1024*1024; io.openx.in.timeout = 0; - 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.openx.out.file.fnum; @@ -1335,7 +1335,7 @@ done: /* A little torture test to expose a race condition in Samba 3.0.20 ... :-) */ -static bool test_raw_open_multi(void) +static bool test_raw_open_multi(struct torture_context *tctx) { struct smbcli_state *cli; TALLOC_CTX *mem_ctx = talloc_init("torture_test_oplock_multi"); @@ -1346,8 +1346,8 @@ static bool test_raw_open_multi(void) struct smbcli_state **clients; struct smbcli_request **requests; union smb_open *ios; - const char *host = lp_parm_string(global_loadparm, NULL, "torture", "host"); - const char *share = lp_parm_string(global_loadparm, NULL, "torture", "share"); + const char *host = torture_setting_string(tctx, "host", NULL); + const char *share = torture_setting_string(tctx, "share", NULL); int i, num_files = 3; struct event_context *ev; int num_ok = 0; @@ -1470,7 +1470,7 @@ bool torture_raw_open(struct torture_context *torture, struct smbcli_state *cli) ret &= test_ntcreatex_brlocked(cli, torture); ret &= test_open(cli, torture); - ret &= test_raw_open_multi(); + ret &= test_raw_open_multi(torture); ret &= test_openx(cli, torture); ret &= test_ntcreatex(cli, torture); ret &= test_nttrans_create(cli, torture); diff --git a/source4/torture/raw/pingpong.c b/source4/torture/raw/pingpong.c index 2e9de28d67..3174021f7b 100755 --- a/source4/torture/raw/pingpong.c +++ b/source4/torture/raw/pingpong.c @@ -191,21 +191,21 @@ bool torture_ping_pong(struct torture_context *torture) uint8_t *val; int count, loops; - fn = lp_parm_string(global_loadparm, NULL, "torture", "filename"); + fn = torture_setting_string(torture, "filename", NULL); if (fn == NULL) { DEBUG(0,("You must specify the filename using --option=torture:filename=...\n")); return false; } - num_locks = lp_parm_int(global_loadparm, NULL, "torture", "num_locks", -1); + num_locks = torture_setting_int(torture, "num_locks", -1); if (num_locks == -1) { DEBUG(0,("You must specify num_locks using --option=torture:num_locks=...\n")); return false; } - do_reads = lp_parm_bool(global_loadparm, NULL, "torture", "read", false); - do_writes = lp_parm_bool(global_loadparm, NULL, "torture", "write", false); - lock_timeout = lp_parm_int(global_loadparm, NULL, "torture", "lock_timeout", 100000); + do_reads = torture_setting_bool(torture, "read", false); + do_writes = torture_setting_bool(torture, "write", false); + lock_timeout = torture_setting_int(torture, "lock_timeout", 100000); if (!torture_open_connection(&cli, 0)) { DEBUG(0,("Could not open connection\n")); diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c index 90f6a3d4a8..b052da2d69 100644 --- a/source4/torture/raw/read.c +++ b/source4/torture/raw/read.c @@ -482,7 +482,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) CHECK_STATUS(status, NT_STATUS_OK); CHECK_VALUE(io.readx.out.remaining, 0xFFFF); CHECK_VALUE(io.readx.out.compaction_mode, 0); - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) { + if (torture_setting_bool(tctx, "samba3", false)) { printf("SAMBA3: large read extension\n"); CHECK_VALUE(io.readx.out.nread, 80000); } else { @@ -526,7 +526,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) io.readx.in.maxcnt = 0x10000; status = smb_raw_read(cli->tree, &io); CHECK_STATUS(status, NT_STATUS_OK); - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) { + if (torture_setting_bool(tctx, "samba3", false)) { printf("SAMBA3: large read extension\n"); CHECK_VALUE(io.readx.out.nread, 0x10000); } else { @@ -536,7 +536,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) io.readx.in.maxcnt = 0x10001; status = smb_raw_read(cli->tree, &io); CHECK_STATUS(status, NT_STATUS_OK); - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) { + if (torture_setting_bool(tctx, "samba3", false)) { printf("SAMBA3: large read extension\n"); CHECK_VALUE(io.readx.out.nread, 0x10001); } else { diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 8e41469963..a075277efb 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -344,9 +344,9 @@ bool torture_samba3_badpath(struct torture_context *torture) return false; } - nt_status_support = lp_nt_status_support(global_loadparm); + nt_status_support = lp_nt_status_support(torture->lp_ctx); - if (!lp_set_cmdline(global_loadparm, "nt status support", "yes")) { + if (!lp_set_cmdline(torture->lp_ctx, "nt status support", "yes")) { printf("Could not set 'nt status support = yes'\n"); goto fail; } @@ -355,7 +355,7 @@ bool torture_samba3_badpath(struct torture_context *torture) goto fail; } - if (!lp_set_cmdline(global_loadparm, "nt status support", "no")) { + if (!lp_set_cmdline(torture->lp_ctx, "nt status support", "no")) { printf("Could not set 'nt status support = yes'\n"); goto fail; } @@ -364,7 +364,7 @@ bool torture_samba3_badpath(struct torture_context *torture) goto fail; } - if (!lp_set_cmdline(global_loadparm, "nt status support", + if (!lp_set_cmdline(torture->lp_ctx, "nt status support", nt_status_support ? "yes":"no")) { printf("Could not reset 'nt status support = yes'"); goto fail; diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c index b9043a5899..d34bbeb9a5 100644 --- a/source4/torture/raw/unlink.c +++ b/source4/torture/raw/unlink.c @@ -129,7 +129,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli) io.unlink.in.attrib = FILE_ATTRIBUTE_DIRECTORY; status = smb_raw_unlink(cli->tree, &io); - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) { + if (torture_setting_bool(tctx, "samba3", false)) { /* * In Samba3 we gave up upon getting the error codes in * wildcard unlink correct. Trying gentest showed that this is @@ -157,7 +157,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli) io.unlink.in.pattern = BASEDIR "\\t*"; io.unlink.in.attrib = FILE_ATTRIBUTE_DIRECTORY; status = smb_raw_unlink(cli->tree, &io); - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) { + if (torture_setting_bool(tctx, "samba3", false)) { CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); } else { @@ -169,7 +169,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli) io.unlink.in.pattern = BASEDIR "\\*.dat"; io.unlink.in.attrib = FILE_ATTRIBUTE_DIRECTORY; status = smb_raw_unlink(cli->tree, &io); - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) { + if (torture_setting_bool(tctx, "samba3", false)) { CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); } else { @@ -179,7 +179,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli) io.unlink.in.pattern = BASEDIR "\\*.tx?"; io.unlink.in.attrib = 0; status = smb_raw_unlink(cli->tree, &io); - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) { + if (torture_setting_bool(tctx, "samba3", false)) { CHECK_STATUS(status, NT_STATUS_NO_SUCH_FILE); } else { @@ -282,7 +282,7 @@ static bool test_delete_on_close(struct torture_context *tctx, CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND); - if (!lp_parm_bool(global_loadparm, NULL, "torture", "samba3", false)) { + if (!torture_setting_bool(tctx, "samba3", false)) { /* * Known deficiency, also skipped in base-delete. -- cgit