diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-06-05 22:03:17 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-06-05 22:03:17 +0200 |
commit | d51904c48970265e84c303ae97502152b85da587 (patch) | |
tree | dfb75ae9712bac4ab6e25bd3bb3d79b6465685f0 /source4/torture | |
parent | d05ca8cbba364b65780d35a32495d6388bc3caa8 (diff) | |
parent | c6cc3cb88ec271da6c372ec881ea66ab8f6e2b68 (diff) | |
download | samba-d51904c48970265e84c303ae97502152b85da587.tar.gz samba-d51904c48970265e84c303ae97502152b85da587.tar.bz2 samba-d51904c48970265e84c303ae97502152b85da587.zip |
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-test
(This used to be commit dcdfee611ccc0ae798e3eea2cfdf3c7642dc5677)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/basic/delaywrite.c | 16 | ||||
-rw-r--r-- | source4/torture/gentest.c | 15 | ||||
-rw-r--r-- | source4/torture/local/local.c | 5 | ||||
-rw-r--r-- | source4/torture/nbench/nbench.c | 3 | ||||
-rw-r--r-- | source4/torture/smb2/getinfo.c | 35 | ||||
-rw-r--r-- | source4/torture/smb2/lock.c | 12 | ||||
-rw-r--r-- | source4/torture/smb2/scan.c | 17 |
7 files changed, 57 insertions, 46 deletions
diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c index 84adfef61a..c03e89d36e 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; \ } \ @@ -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; \ @@ -828,6 +816,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 +971,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(); 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: 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())); 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; 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); diff --git a/source4/torture/smb2/lock.c b/source4/torture/smb2/lock.c index 35ad839610..d820983022 100644 --- a/source4/torture/smb2/lock.c +++ b/source4/torture/smb2/lock.c @@ -268,20 +268,12 @@ 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; 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; 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)); } |