diff options
author | Tim Prouty <tprouty@samba.org> | 2010-06-14 16:50:29 -0700 |
---|---|---|
committer | Tim Prouty <tprouty@samba.org> | 2010-06-15 13:48:15 -0700 |
commit | 2170a59215d00554b97dc2053eeb6dde38ef3e97 (patch) | |
tree | e20e81fde8e62a142629b02af8b574d9eae38b83 /source4/torture/raw | |
parent | a4a127ea5a62102890f4eecde45fdb244023dfa3 (diff) | |
download | samba-2170a59215d00554b97dc2053eeb6dde38ef3e97.tar.gz samba-2170a59215d00554b97dc2053eeb6dde38ef3e97.tar.bz2 samba-2170a59215d00554b97dc2053eeb6dde38ef3e97.zip |
s4 torture: RAW-SEARCH: Only test supported info levels
Diffstat (limited to 'source4/torture/raw')
-rw-r--r-- | source4/torture/raw/search.c | 54 |
1 files changed, 45 insertions, 9 deletions
diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c index 3951605834..50f6e76193 100644 --- a/source4/torture/raw/search.c +++ b/source4/torture/raw/search.c @@ -28,6 +28,23 @@ #define BASEDIR "\\testsearch" +#define CHECK_STATUS_LEVEL(__tctx, __status, __level, __supp) \ + do { \ + if (NT_STATUS_EQUAL(__status, \ + NT_STATUS_NOT_SUPPORTED) || \ + NT_STATUS_EQUAL(__status, \ + NT_STATUS_NOT_IMPLEMENTED)) { \ + torture_warning(__tctx, "(%s) Info " \ + "level "#__level" is %s", \ + __location__, nt_errstr(__status)); \ + __supp = false; \ + } else { \ + torture_assert_ntstatus_ok_goto(__tctx, \ + __status, ret, done, #__level" failed"); \ + __supp = true; \ + } \ + } while (0) + /* callback function for single_search */ @@ -242,6 +259,8 @@ static bool test_one_file(struct torture_context *tctx, NTSTATUS status; int i; union smb_fileinfo all_info, alt_info, name_info, internal_info; + bool all_info_supported, alt_info_supported, name_info_supported, + internal_info_supported; union smb_search_data *s; fnum = create_complex_file(cli, tctx, fname); @@ -304,22 +323,26 @@ static bool test_one_file(struct torture_context *tctx, all_info.generic.level = RAW_FILEINFO_ALL_INFO; all_info.generic.in.file.path = fname; status = smb_raw_pathinfo(cli->tree, tctx, &all_info); - torture_assert_ntstatus_ok(tctx, status, "RAW_FILEINFO_ALL_INFO failed"); + CHECK_STATUS_LEVEL(tctx, status, "RAW_FILEINFO_ALL_INFO", + all_info_supported); alt_info.generic.level = RAW_FILEINFO_ALT_NAME_INFO; alt_info.generic.in.file.path = fname; status = smb_raw_pathinfo(cli->tree, tctx, &alt_info); - torture_assert_ntstatus_ok(tctx, status, "RAW_FILEINFO_ALT_NAME_INFO failed"); + CHECK_STATUS_LEVEL(tctx, status, "RAW_FILEINFO_ALT_NAME_INFO", + alt_info_supported); internal_info.generic.level = RAW_FILEINFO_INTERNAL_INFORMATION; internal_info.generic.in.file.path = fname; status = smb_raw_pathinfo(cli->tree, tctx, &internal_info); - torture_assert_ntstatus_ok(tctx, status, "RAW_FILEINFO_INTERNAL_INFORMATION failed"); + CHECK_STATUS_LEVEL(tctx, status, "RAW_FILEINFO_INTERNAL_INFORMATION", + internal_info_supported); name_info.generic.level = RAW_FILEINFO_NAME_INFO; name_info.generic.in.file.path = fname; status = smb_raw_pathinfo(cli->tree, tctx, &name_info); - torture_assert_ntstatus_ok(tctx, status, "RAW_FILEINFO_NAME_INFO failed"); + CHECK_STATUS_LEVEL(tctx, status, "RAW_FILEINFO_NAME_INFO", + name_info_supported); #define CHECK_VAL(name, sname1, field1, v, sname2, field2) do { \ s = find(name); \ @@ -477,21 +500,34 @@ static bool test_one_file(struct torture_context *tctx, CHECK_VAL("ID_FULL_DIRECTORY_INFO", id_full_directory_info, ea_size, all_info, all_info, ea_size); CHECK_VAL("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, ea_size, all_info, all_info, ea_size); - CHECK_STR("SEARCH", search, name, alt_info, alt_name_info, fname); - CHECK_WSTR("BOTH_DIRECTORY_INFO", both_directory_info, short_name, alt_info, alt_name_info, fname, STR_UNICODE); + if (alt_info_supported) { + CHECK_STR("SEARCH", search, name, alt_info, alt_name_info, + fname); + CHECK_WSTR("BOTH_DIRECTORY_INFO", both_directory_info, + short_name, alt_info, alt_name_info, fname, STR_UNICODE); + } CHECK_NAME("STANDARD", standard, name, fname+1, 0); CHECK_NAME("EA_SIZE", ea_size, name, fname+1, 0); CHECK_NAME("DIRECTORY_INFO", directory_info, name, fname+1, STR_TERMINATE_ASCII); CHECK_NAME("FULL_DIRECTORY_INFO", full_directory_info, name, fname+1, STR_TERMINATE_ASCII); - CHECK_NAME("NAME_INFO", name_info, name, fname+1, STR_TERMINATE_ASCII); + + if (name_info_supported) { + CHECK_NAME("NAME_INFO", name_info, name, fname+1, + STR_TERMINATE_ASCII); + } + CHECK_NAME("BOTH_DIRECTORY_INFO", both_directory_info, name, fname+1, STR_TERMINATE_ASCII); CHECK_NAME("ID_FULL_DIRECTORY_INFO", id_full_directory_info, name, fname+1, STR_TERMINATE_ASCII); CHECK_NAME("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, name, fname+1, STR_TERMINATE_ASCII); CHECK_UNIX_NAME("UNIX_INFO", unix_info, name, fname+1, STR_TERMINATE_ASCII); - CHECK_VAL("ID_FULL_DIRECTORY_INFO", id_full_directory_info, file_id, internal_info, internal_information, file_id); - CHECK_VAL("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, file_id, internal_info, internal_information, file_id); + if (internal_info_supported) { + CHECK_VAL("ID_FULL_DIRECTORY_INFO", id_full_directory_info, + file_id, internal_info, internal_information, file_id); + CHECK_VAL("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, + file_id, internal_info, internal_information, file_id); + } done: smb_raw_exit(cli->session); |