diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-03 00:28:22 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:47:20 +0100 |
commit | bbdfbf8d9d486aee51117976b8f825759a4c4a37 (patch) | |
tree | c0f97e145aae09c3e7e5387471fb3fb0ab839596 /source4/torture/smb2 | |
parent | 291ddf433685ee5c25e172885045a4b60d7bb1ee (diff) | |
download | samba-bbdfbf8d9d486aee51117976b8f825759a4c4a37.tar.gz |
r26238: Add a loadparm context parameter to torture_context, remove more uses of global_loadparm.
(This used to be commit a33a5530545086b81a3b205aa109dff11c546926)
Diffstat (limited to 'source4/torture/smb2')
-rw-r--r-- | source4/torture/smb2/connect.c | 2 | ||||
-rw-r--r-- | source4/torture/smb2/dir.c | 2 | ||||
-rw-r--r-- | source4/torture/smb2/find.c | 2 | ||||
-rw-r--r-- | source4/torture/smb2/getinfo.c | 2 | ||||
-rw-r--r-- | source4/torture/smb2/maxwrite.c | 13 | ||||
-rw-r--r-- | source4/torture/smb2/notify.c | 7 | ||||
-rw-r--r-- | source4/torture/smb2/scan.c | 23 | ||||
-rw-r--r-- | source4/torture/smb2/setinfo.c | 16 | ||||
-rw-r--r-- | source4/torture/smb2/util.c | 10 |
9 files changed, 30 insertions, 47 deletions
diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index d01c138ef87..f1bc63dbbb8 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -196,7 +196,7 @@ bool torture_smb2_connect(struct torture_context *torture) struct smb2_handle h1, h2; NTSTATUS status; - if (!torture_smb2_connection(mem_ctx, &tree)) { + if (!torture_smb2_connection(torture, &tree)) { return false; } diff --git a/source4/torture/smb2/dir.c b/source4/torture/smb2/dir.c index eb24dd08849..58cf2229bc7 100644 --- a/source4/torture/smb2/dir.c +++ b/source4/torture/smb2/dir.c @@ -81,7 +81,7 @@ bool torture_smb2_dir(struct torture_context *torture) struct smb2_tree *tree; bool ret = true; - if (!torture_smb2_connection(mem_ctx, &tree)) { + if (!torture_smb2_connection(torture, &tree)) { return false; } diff --git a/source4/torture/smb2/find.c b/source4/torture/smb2/find.c index 654866dfb5d..06222e8e9e9 100644 --- a/source4/torture/smb2/find.c +++ b/source4/torture/smb2/find.c @@ -202,7 +202,7 @@ bool torture_smb2_find(struct torture_context *torture) bool ret = true; NTSTATUS status; - if (!torture_smb2_connection(mem_ctx, &tree)) { + if (!torture_smb2_connection(torture, &tree)) { return false; } diff --git a/source4/torture/smb2/getinfo.c b/source4/torture/smb2/getinfo.c index 9ed0b9ddb59..73107a52174 100644 --- a/source4/torture/smb2/getinfo.c +++ b/source4/torture/smb2/getinfo.c @@ -177,7 +177,7 @@ bool torture_smb2_getinfo(struct torture_context *torture) bool ret = true; NTSTATUS status; - if (!torture_smb2_connection(mem_ctx, &tree)) { + if (!torture_smb2_connection(torture, &tree)) { return false; } diff --git a/source4/torture/smb2/maxwrite.c b/source4/torture/smb2/maxwrite.c index 588a49221e1..892bbd73ac0 100644 --- a/source4/torture/smb2/maxwrite.c +++ b/source4/torture/smb2/maxwrite.c @@ -31,7 +31,7 @@ /* test writing */ -static NTSTATUS torture_smb2_write(TALLOC_CTX *mem_ctx, +static NTSTATUS torture_smb2_write(struct torture_context *tctx, struct smb2_tree *tree, struct smb2_handle handle) { @@ -43,7 +43,7 @@ static NTSTATUS torture_smb2_write(TALLOC_CTX *mem_ctx, int min = 1; while (max > min) { - TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); + TALLOC_CTX *tmp_ctx = talloc_new(tctx); len = 1+(min+max)/2; @@ -69,7 +69,7 @@ static NTSTATUS torture_smb2_write(TALLOC_CTX *mem_ctx, /* vista bug */ printf("coping with server disconnect\n"); talloc_free(tree); - if (!torture_smb2_connection(mem_ctx, &tree)) { + if (!torture_smb2_connection(torture, &tree)) { printf("failed to reconnect\n"); return NT_STATUS_NET_WRITE_FAULT; } @@ -113,23 +113,20 @@ static NTSTATUS torture_smb2_write(TALLOC_CTX *mem_ctx, */ bool torture_smb2_maxwrite(struct torture_context *torture) { - TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smb2_tree *tree; struct smb2_handle h1; NTSTATUS status; - if (!torture_smb2_connection(mem_ctx, &tree)) { + if (!torture_smb2_connection(torture, &tree)) { return false; } h1 = torture_smb2_create(tree, FNAME); - status = torture_smb2_write(mem_ctx, tree, h1); + status = torture_smb2_write(torture, tree, h1); if (!NT_STATUS_IS_OK(status)) { printf("Write failed - %s\n", nt_errstr(status)); return false; } - talloc_free(mem_ctx); - return true; } diff --git a/source4/torture/smb2/notify.c b/source4/torture/smb2/notify.c index cabe81ca71e..574136ab3f2 100644 --- a/source4/torture/smb2/notify.c +++ b/source4/torture/smb2/notify.c @@ -190,17 +190,14 @@ done: */ bool torture_smb2_notify(struct torture_context *torture) { - TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smb2_tree *tree; bool ret = true; - if (!torture_smb2_connection(mem_ctx, &tree)) { + if (!torture_smb2_connection(torture, &tree)) { return false; } - ret &= test_valid_request(mem_ctx, tree); - - talloc_free(mem_ctx); + ret &= test_valid_request(torture, tree); return ret; } diff --git a/source4/torture/smb2/scan.c b/source4/torture/smb2/scan.c index f3e4d5cd36a..eda753b1ee8 100644 --- a/source4/torture/smb2/scan.c +++ b/source4/torture/smb2/scan.c @@ -37,14 +37,13 @@ */ bool torture_smb2_getinfo_scan(struct torture_context *torture) { - TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smb2_tree *tree; NTSTATUS status; struct smb2_getinfo io; struct smb2_handle fhandle, dhandle; int c, i; - if (!torture_smb2_connection(mem_ctx, &tree)) { + if (!torture_smb2_connection(torture, &tree)) { return false; } @@ -74,7 +73,7 @@ bool torture_smb2_getinfo_scan(struct torture_context *torture) io.in.level = (i<<8) | c; io.in.file.handle = fhandle; - status = smb2_getinfo(tree, mem_ctx, &io); + status = smb2_getinfo(tree, torture, &io); if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS) && !NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER) && !NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) { @@ -84,7 +83,7 @@ bool torture_smb2_getinfo_scan(struct torture_context *torture) } io.in.file.handle = dhandle; - status = smb2_getinfo(tree, mem_ctx, &io); + status = smb2_getinfo(tree, torture, &io); if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS) && !NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER) && !NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) { @@ -95,8 +94,6 @@ bool torture_smb2_getinfo_scan(struct torture_context *torture) } } - talloc_free(mem_ctx); - return true; } @@ -105,14 +102,13 @@ bool torture_smb2_getinfo_scan(struct torture_context *torture) */ bool torture_smb2_setinfo_scan(struct torture_context *torture) { - TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smb2_tree *tree; NTSTATUS status; struct smb2_setinfo io; struct smb2_handle handle; int c, i; - if (!torture_smb2_connection(mem_ctx, &tree)) { + if (!torture_smb2_connection(torture, &tree)) { return false; } @@ -126,7 +122,7 @@ bool torture_smb2_setinfo_scan(struct torture_context *torture) torture_smb2_testfile(tree, FNAME, &handle); ZERO_STRUCT(io); - io.in.blob = data_blob_talloc_zero(mem_ctx, 1024); + io.in.blob = data_blob_talloc_zero(torture, 1024); for (c=1;c<5;c++) { for (i=0;i<0x100;i++) { @@ -141,8 +137,6 @@ bool torture_smb2_setinfo_scan(struct torture_context *torture) } } - talloc_free(mem_ctx); - return true; } @@ -152,14 +146,13 @@ bool torture_smb2_setinfo_scan(struct torture_context *torture) */ bool torture_smb2_find_scan(struct torture_context *torture) { - TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smb2_tree *tree; NTSTATUS status; struct smb2_find io; struct smb2_handle handle; int i; - if (!torture_smb2_connection(mem_ctx, &tree)) { + if (!torture_smb2_connection(torture, &tree)) { return false; } @@ -179,7 +172,7 @@ bool torture_smb2_find_scan(struct torture_context *torture) io.in.level = i; io.in.file.handle = handle; - status = smb2_find(tree, mem_ctx, &io); + status = smb2_find(tree, torture, &io); if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS) && !NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER) && !NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) { @@ -189,8 +182,6 @@ bool torture_smb2_find_scan(struct torture_context *torture) } } - talloc_free(mem_ctx); - return true; } diff --git a/source4/torture/smb2/setinfo.c b/source4/torture/smb2/setinfo.c index 6a81f13f67c..685bb5a47b1 100644 --- a/source4/torture/smb2/setinfo.c +++ b/source4/torture/smb2/setinfo.c @@ -40,7 +40,6 @@ bool torture_smb2_setinfo(struct torture_context *torture) { struct smb2_tree *tree; bool ret = true; - TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smb2_handle handle; char *fname; char *fname_new; @@ -56,10 +55,10 @@ bool torture_smb2_setinfo(struct torture_context *torture) ZERO_STRUCT(handle); - fname = talloc_asprintf(mem_ctx, BASEDIR "fnum_test_%d.txt", n); - fname_new = talloc_asprintf(mem_ctx, BASEDIR "fnum_test_new_%d.txt", n); + fname = talloc_asprintf(torture, BASEDIR "fnum_test_%d.txt", n); + fname_new = talloc_asprintf(torture, BASEDIR "fnum_test_new_%d.txt", n); - if (!torture_smb2_connection(mem_ctx, &tree)) { + if (!torture_smb2_connection(torture, &tree)) { return false; } @@ -96,7 +95,7 @@ bool torture_smb2_setinfo(struct torture_context *torture) do { if (NT_STATUS_IS_OK(status)) { \ finfo2.generic.level = RAW_FILEINFO_ ## call; \ finfo2.generic.in.file.handle = handle; \ - status2 = smb2_getinfo_file(tree, mem_ctx, &finfo2); \ + status2 = smb2_getinfo_file(tree, torture, &finfo2); \ if (!NT_STATUS_IS_OK(status2)) { \ printf("(%s) %s - %s\n", __location__, #call, nt_errstr(status2)); \ ret = false; \ @@ -122,8 +121,8 @@ bool torture_smb2_setinfo(struct torture_context *torture) call_name, #stype, #field, \ (uint_t)value, \ (uint_t)nt_time_to_unix(finfo2.stype.out.field)); \ - printf("\t%s", timestring(mem_ctx, value)); \ - printf("\t%s\n", nt_time_string(mem_ctx, finfo2.stype.out.field)); \ + printf("\t%s", timestring(torture, value)); \ + printf("\t%s\n", nt_time_string(torture, finfo2.stype.out.field)); \ torture_smb2_all_info(tree, handle); \ ret = false; \ goto done; \ @@ -240,7 +239,7 @@ bool torture_smb2_setinfo(struct torture_context *torture) CHECK1(SEC_DESC); sd = finfo2.query_secdesc.out.sd; - test_sid = dom_sid_parse_talloc(mem_ctx, "S-1-5-32-1234-5432"); + test_sid = dom_sid_parse_talloc(torture, "S-1-5-32-1234-5432"); ZERO_STRUCT(ace); ace.type = SEC_ACE_TYPE_ACCESS_ALLOWED; ace.flags = 0; @@ -291,7 +290,6 @@ done: } smb2_util_unlink(tree, fname); - talloc_free(mem_ctx); return ret; } diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c index 705f10a8418..ab3d299c5ab 100644 --- a/source4/torture/smb2/util.c +++ b/source4/torture/smb2/util.c @@ -302,15 +302,15 @@ void torture_smb2_all_info(struct smb2_tree *tree, struct smb2_handle handle) /* open a smb2 connection */ -bool torture_smb2_connection(TALLOC_CTX *mem_ctx, struct smb2_tree **tree) +bool torture_smb2_connection(struct torture_context *tctx, struct smb2_tree **tree) { NTSTATUS status; - 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); struct cli_credentials *credentials = cmdline_credentials; - status = smb2_connect(mem_ctx, host, share, credentials, tree, - event_context_find(mem_ctx)); + status = smb2_connect(tctx, host, share, credentials, tree, + event_context_find(tctx)); if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to SMB2 share \\\\%s\\%s - %s\n", host, share, nt_errstr(status)); |