From 57b7b0fcf64f9d6d3393ee379f8c34a2c369674c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 31 May 2008 13:39:34 +1000 Subject: more useful output in scan (This used to be commit 70569a78cf3443ce5c0b0a28dcd17a3031d8aa55) --- source4/torture/smb2/scan.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/smb2/scan.c b/source4/torture/smb2/scan.c index 1ce796be4d..ae51af1882 100644 --- a/source4/torture/smb2/scan.c +++ b/source4/torture/smb2/scan.c @@ -77,22 +77,20 @@ bool torture_smb2_getinfo_scan(struct torture_context *torture) io.in.file.handle = fhandle; 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)) { - printf("file level 0x%02x:%02x is %ld bytes - %s\n", + if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS)) { + printf("file level 0x%02x:%02x %u is %ld bytes - %s\n", io.in.info_type, io.in.info_class, + (unsigned)io.in.info_class, (long)io.out.blob.length, nt_errstr(status)); dump_data(1, io.out.blob.data, io.out.blob.length); } io.in.file.handle = dhandle; 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)) { - printf("dir level 0x%02x:%02x is %ld bytes - %s\n", + if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS)) { + printf("dir level 0x%02x:%02x %u is %ld bytes - %s\n", io.in.info_type, io.in.info_class, + (unsigned)io.in.info_class, (long)io.out.blob.length, nt_errstr(status)); dump_data(1, io.out.blob.data, io.out.blob.length); } @@ -134,8 +132,7 @@ bool torture_smb2_setinfo_scan(struct torture_context *torture) io.in.level = (i<<8) | c; io.in.file.handle = handle; status = smb2_setinfo(tree, &io); - if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS) && - !NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) { + if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS)) { printf("file level 0x%04x - %s\n", io.in.level, nt_errstr(status)); } -- cgit From eb8634b2f02bb0134435a964bb9687f0de32b349 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 31 May 2008 13:39:51 +1000 Subject: check for requested buffer size in getinfo call (This used to be commit ed8f16379d01d3dffd2645e2b275aa27507dfec9) --- source4/torture/smb2/getinfo.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'source4/torture') diff --git a/source4/torture/smb2/getinfo.c b/source4/torture/smb2/getinfo.c index 906d6e4f8d..5b35d7e693 100644 --- a/source4/torture/smb2/getinfo.c +++ b/source4/torture/smb2/getinfo.c @@ -167,6 +167,40 @@ static bool torture_smb2_fsinfo(struct smb2_tree *tree) } +/* + test for buffer size handling +*/ +static bool torture_smb2_buffercheck(struct smb2_tree *tree) +{ + NTSTATUS status; + struct smb2_handle handle; + struct smb2_getinfo b; + + printf("Testing buffer size handling\n"); + status = smb2_util_roothandle(tree, &handle); + if (!NT_STATUS_IS_OK(status)) { + printf(__location__ " Unable to create root handle - %s\n", nt_errstr(status)); + return false; + } + + ZERO_STRUCT(b); + b.in.info_type = SMB2_GETINFO_FS; + b.in.info_class = 1; + b.in.output_buffer_length = 0x1; + b.in.input_buffer_length = 0; + b.in.file.handle = handle; + + status = smb2_getinfo(tree, tree, &b); + if (!NT_STATUS_EQUAL(status, NT_STATUS_INFO_LENGTH_MISMATCH)) { + printf(__location__ " Wrong error code for small buffer %s\n", + nt_errstr(status)); + return false; + } + + return true; +} + + /* basic testing of all SMB2 getinfo levels */ bool torture_smb2_getinfo(struct torture_context *torture) @@ -196,6 +230,7 @@ bool torture_smb2_getinfo(struct torture_context *torture) ret &= torture_smb2_fileinfo(torture, tree); ret &= torture_smb2_fsinfo(tree); + ret &= torture_smb2_buffercheck(tree); talloc_free(mem_ctx); -- cgit From e7b30f023bd8b1003f5283ffc1bf1d2edb6fb281 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 2 Jun 2008 11:04:36 +1000 Subject: remove unused macros (This used to be commit 7a1877db15e6a57f0f057dcf5da6609b9bdeef51) --- source4/torture/basic/delaywrite.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c index 84adfef61a..ac4f565a2b 100644 --- a/source4/torture/basic/delaywrite.c +++ b/source4/torture/basic/delaywrite.c @@ -673,23 +673,11 @@ static bool test_finfo_after_write(struct torture_context *tctx, struct smbcli_s } while (0) #define COMPARE_ACCESS_TIME_EQUAL(given,correct) \ COMPARE_ACCESS_TIME_CMP(given,correct,!=) -#define COMPARE_ACCESS_TIME_GREATER(given,correct) \ - COMPARE_ACCESS_TIME_CMP(given,correct,<=) -#define COMPARE_ACCESS_TIME_LESS(given,correct) \ - COMPARE_ACCESS_TIME_CMP(given,correct,>=) #define COMPARE_BOTH_TIMES_EQUAL(given,correct) do { \ COMPARE_ACCESS_TIME_EQUAL(given,correct); \ COMPARE_WRITE_TIME_EQUAL(given,correct); \ } while (0) -#define COMPARE_BOTH_TIMES_GEATER(given,correct) do { \ - COMPARE_ACCESS_TIME_GREATER(given,correct); \ - COMPARE_WRITE_TIME_GREATER(given,correct); \ -} while (0) -#define COMPARE_BOTH_TIMES_LESS(given,correct) do { \ - COMPARE_ACCESS_TIME_LESS(given,correct); \ - COMPARE_WRITE_TIME_LESS(given,correct); \ -} while (0) #define GET_INFO_FILE(finfo) do { \ NTSTATUS _status; \ -- cgit From fa327874bbbfc7ae1693adb1b87cae3f5d0857ec Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 2 Jun 2008 11:04:46 +1000 Subject: remove a pstring (This used to be commit 12ecd7f4b8934e3e11e8b6019b92b82a53e55b96) --- source4/torture/nbench/nbench.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/nbench/nbench.c b/source4/torture/nbench/nbench.c index 96144c4773..5a4037f906 100644 --- a/source4/torture/nbench/nbench.c +++ b/source4/torture/nbench/nbench.c @@ -23,7 +23,6 @@ #include "torture/smbtorture.h" #include "system/filesys.h" #include "system/locale.h" -#include "pstring.h" #include "torture/nbench/proto.h" @@ -59,7 +58,7 @@ static bool run_netbench(struct torture_context *tctx, struct smbcli_state *cli, { int torture_nprocs = torture_setting_int(tctx, "nprocs", 4); int i; - pstring line; + char line[1024]; char *cname; FILE *f; bool correct = true; -- cgit From 405e64c437348bc9e3f7d4412a55e5cf05b3890d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 2 Jun 2008 11:05:06 +1000 Subject: more updates for new info levels (This used to be commit 85d1873ee92fcc7df3addc42ddb8189144901f8b) --- source4/torture/gentest.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 07d394fad6..60243a5d1b 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -2199,16 +2199,20 @@ static void gen_setfileinfo(int instance, union smb_setfileinfo *info) LVL(STANDARD), LVL(ALLOCATION_INFO), LVL(END_OF_FILE_INFO), LVL(SETATTR), LVL(SETATTRE), LVL(BASIC_INFORMATION), LVL(RENAME_INFORMATION), LVL(DISPOSITION_INFORMATION), - LVL(POSITION_INFORMATION), LVL(MODE_INFORMATION), + LVL(POSITION_INFORMATION), LVL(FULL_EA_INFORMATION), LVL(MODE_INFORMATION), LVL(ALLOCATION_INFORMATION), LVL(END_OF_FILE_INFORMATION), - LVL(1023), LVL(1025), LVL(1029), LVL(1032), LVL(1039), LVL(1040), + LVL(PIPE_INFORMATION), LVL(VALID_DATA_INFORMATION), LVL(SHORT_NAME_INFORMATION), + LVL(1025), LVL(1027), LVL(1029), LVL(1030), LVL(1031), LVL(1032), LVL(1036), + LVL(1041), LVL(1042), LVL(1043), LVL(1044), }; struct levels smb2_levels[] = { LVL(BASIC_INFORMATION), LVL(RENAME_INFORMATION), LVL(DISPOSITION_INFORMATION), - LVL(POSITION_INFORMATION), LVL(MODE_INFORMATION), + LVL(POSITION_INFORMATION), LVL(FULL_EA_INFORMATION), LVL(MODE_INFORMATION), LVL(ALLOCATION_INFORMATION), LVL(END_OF_FILE_INFORMATION), - LVL(1023), LVL(1025), LVL(1029), LVL(1032), LVL(1039), LVL(1040) + LVL(PIPE_INFORMATION), LVL(VALID_DATA_INFORMATION), LVL(SHORT_NAME_INFORMATION), + LVL(1025), LVL(1027), LVL(1029), LVL(1030), LVL(1031), LVL(1032), LVL(1036), + LVL(1041), LVL(1042), LVL(1043), LVL(1044), }; struct levels *levels = options.smb2?smb2_levels:smb_levels; uint32_t num_levels = options.smb2?ARRAY_SIZE(smb2_levels):ARRAY_SIZE(smb_levels); @@ -2276,12 +2280,9 @@ static void gen_setfileinfo(int instance, union smb_setfileinfo *info) case RAW_SFILEINFO_GENERIC: case RAW_SFILEINFO_SEC_DESC: - case RAW_SFILEINFO_1023: case RAW_SFILEINFO_1025: case RAW_SFILEINFO_1029: case RAW_SFILEINFO_1032: - case RAW_SFILEINFO_1039: - case RAW_SFILEINFO_1040: case RAW_SFILEINFO_UNIX_BASIC: case RAW_SFILEINFO_UNIX_INFO2: case RAW_SFILEINFO_UNIX_LINK: -- cgit From fb4c9dd5ebed4af38b3e2f6022770a7586e39926 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 5 May 2008 15:05:41 +0200 Subject: BASE-DELAYWRITE: add missing time checks to make sure the server has updated the write time metze (This used to be commit 9c004df8910c07d75bb3f75d7c3cfba9f9c94f51) --- source4/torture/basic/delaywrite.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/torture') diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c index 84adfef61a..0e226b788d 100644 --- a/source4/torture/basic/delaywrite.c +++ b/source4/torture/basic/delaywrite.c @@ -828,6 +828,7 @@ static bool test_delayed_write_update3(struct torture_context *tctx, } GET_INFO_BOTH(finfo1,pinfo1); + COMPARE_WRITE_TIME_GREATER(pinfo1, pinfo0); /* sure any further write doesn't update the write time */ start = timeval_current(); @@ -982,6 +983,7 @@ static bool test_delayed_write_update4(struct torture_context *tctx, } GET_INFO_BOTH(finfo1,pinfo1); + COMPARE_WRITE_TIME_GREATER(pinfo1, pinfo0); /* sure any further write doesn't update the write time */ start = timeval_current(); -- cgit From 6610a6c49a2140747aa8e36c26f855953471140d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 3 Jun 2008 14:01:02 +0200 Subject: BASE-DELAYWRITE: fix test on filesystem without high resolution timestamps metze (This used to be commit fde9880f9943897549859037b0fc9341d3a032f7) --- source4/torture/basic/delaywrite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture') diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c index 0e226b788d..c7bccae08f 100644 --- a/source4/torture/basic/delaywrite.c +++ b/source4/torture/basic/delaywrite.c @@ -641,7 +641,7 @@ static bool test_finfo_after_write(struct torture_context *tctx, struct smbcli_s bool err = false; \ if (strict && (g cmp c)) { \ err = true; \ - } else if (gr cmp cr) { \ + } else if ((g cmp c) && (gr cmp cr)) { \ /* handle filesystem without high resolution timestamps */ \ err = true; \ } \ -- cgit From 869991385827d14f4e55729e4d56a80eccf9fdec Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 4 Jun 2008 08:54:42 +0200 Subject: lib/crypto: remove unused sha1 and hmac-sha1 code metze (This used to be commit 2c8904be3bac2c696712cc3160fe95d62afde43a) --- source4/torture/local/local.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/local/local.c b/source4/torture/local/local.c index 1c3274adcd..bf53df4a11 100644 --- a/source4/torture/local/local.c +++ b/source4/torture/local/local.c @@ -68,16 +68,13 @@ NTSTATUS torture_local_init(void) torture_suite_add_simple_test(suite, "TALLOC", torture_local_talloc); torture_suite_add_simple_test(suite, "REPLACE", torture_local_replace); - torture_suite_add_simple_test(suite, "CRYPTO-SHA1", - torture_local_crypto_sha1); torture_suite_add_simple_test(suite, "CRYPTO-MD4", torture_local_crypto_md4); torture_suite_add_simple_test(suite, "CRYPTO-MD5", torture_local_crypto_md5); torture_suite_add_simple_test(suite, "CRYPTO-HMACMD5", torture_local_crypto_hmacmd5); - torture_suite_add_simple_test(suite, "CRYPTO-HMACSHA1", - torture_local_crypto_hmacsha1); + for (i = 0; suite_generators[i]; i++) torture_suite_add_suite(suite, suite_generators[i](talloc_autofree_context())); -- cgit From 93d6332e7e9fd54518d8209493b3b23301c299db Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 4 Jun 2008 13:04:48 -0700 Subject: fixed SMB2-LOCK test for new semantics (from docs) (This used to be commit d4d4d62939e325f8529b11fcd2d490e8f63293b0) --- source4/torture/smb2/lock.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/smb2/lock.c b/source4/torture/smb2/lock.c index 35ad839610..1b08efc0fa 100644 --- a/source4/torture/smb2/lock.c +++ b/source4/torture/smb2/lock.c @@ -268,11 +268,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree lck.in.lock_count = 1; el[0].flags = SMB2_LOCK_FLAG_UNLOCK; status = smb2_lock(tree, &lck); - if (torture_setting_bool(torture, "windows", false)) { - CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED); - } else { - CHECK_STATUS(status, NT_STATUS_OK); - } + CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED); lck.in.lock_count = 1; el[0].flags = SMB2_LOCK_FLAG_UNLOCK; -- cgit From c6cc3cb88ec271da6c372ec881ea66ab8f6e2b68 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 4 Jun 2008 17:52:13 -0700 Subject: another SMB2-LOCK fix now that we know that the UNLOCK flag is only honoured on the first lock in a set (This used to be commit c014ffabc65c30a6b83c8f9f9f9a80bb79333f59) --- source4/torture/smb2/lock.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/smb2/lock.c b/source4/torture/smb2/lock.c index 1b08efc0fa..d820983022 100644 --- a/source4/torture/smb2/lock.c +++ b/source4/torture/smb2/lock.c @@ -273,11 +273,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree lck.in.lock_count = 1; el[0].flags = SMB2_LOCK_FLAG_UNLOCK; status = smb2_lock(tree, &lck); - if (torture_setting_bool(torture, "windows", false)) { - CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED); - } else { - CHECK_STATUS(status, NT_STATUS_OK); - } + CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED); lck.in.lock_count = 1; el[0].flags = SMB2_LOCK_FLAG_UNLOCK; -- cgit