diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-09-02 04:37:33 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-09-02 04:37:33 +0000 |
commit | 0becf4d68329ca599f3e34ee97ca3f72d0e9425f (patch) | |
tree | 14a66389e715d34a43e65d590650fc356113c796 | |
parent | 11c5869a450d5f78a9395889ec03f77732cc8be5 (diff) | |
download | samba-0becf4d68329ca599f3e34ee97ca3f72d0e9425f.tar.gz samba-0becf4d68329ca599f3e34ee97ca3f72d0e9425f.tar.bz2 samba-0becf4d68329ca599f3e34ee97ca3f72d0e9425f.zip |
thanks to ntfsd and some google searches I worked out what the unknown
fields in level 261 and level 262 of directory search are, plus the
names of the levels
the unknown fields are a 64bit unique file id, and match the 64 bit
number from the internal_information qfileinfo level
(This used to be commit b69f54eb028a24144a2e813f059b08644118ab09)
-rw-r--r-- | source4/client/client.c | 5 | ||||
-rw-r--r-- | source4/include/smb_interfaces.h | 24 | ||||
-rw-r--r-- | source4/include/trans2.h | 4 | ||||
-rw-r--r-- | source4/libcli/raw/rawfileinfo.c | 3 | ||||
-rw-r--r-- | source4/libcli/raw/rawsearch.c | 53 | ||||
-rw-r--r-- | source4/ntvfs/ntvfs_generic.c | 3 | ||||
-rw-r--r-- | source4/ntvfs/simple/svfs_util.c | 11 | ||||
-rw-r--r-- | source4/ntvfs/simple/vfs_simple.c | 3 | ||||
-rw-r--r-- | source4/smbd/trans2.c | 57 | ||||
-rw-r--r-- | source4/torture/gentest.c | 5 | ||||
-rw-r--r-- | source4/torture/raw/qfileinfo.c | 9 | ||||
-rw-r--r-- | source4/torture/raw/search.c | 70 | ||||
-rw-r--r-- | source4/torture/raw/setfileinfo.c | 10 | ||||
-rw-r--r-- | source4/torture/search.c | 40 | ||||
-rw-r--r-- | source4/torture/torture_util.c | 4 |
15 files changed, 161 insertions, 140 deletions
diff --git a/source4/client/client.c b/source4/client/client.c index e418f3b456..2cc3746376 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -1683,12 +1683,11 @@ static int cmd_allinfo(void) d_printf("\talt_name: %s\n", finfo.alt_name_info.out.fname.s); } - /* dev/inode if available */ + /* file_id if available */ finfo.generic.level = RAW_FILEINFO_INTERNAL_INFORMATION; status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); if (NT_STATUS_IS_OK(status)) { - d_printf("\tdevice 0x%x\n", finfo.internal_information.out.device); - d_printf("\tinode 0x%x\n", finfo.internal_information.out.inode); + d_printf("\tfile_id %.0f\n", finfo.internal_information.out.file_id); } /* the EAs, if any */ diff --git a/source4/include/smb_interfaces.h b/source4/include/smb_interfaces.h index d087d2642e..9ac9f418ea 100644 --- a/source4/include/smb_interfaces.h +++ b/source4/include/smb_interfaces.h @@ -383,8 +383,7 @@ union smb_fileinfo { uint8 unit_shift; uint8 chunk_shift; uint8 cluster_shift; - uint32 device; - uint32 inode; + large_t file_id; uint32 access_flags; /* seen 0x001f01ff from w2k3 */ large_t position; uint32 mode; @@ -621,10 +620,7 @@ union smb_fileinfo { union smb_fileinfo_in in; struct { - /* REWRITE: these are very uncertain - we need - * to look at this interface */ - uint32 device; - uint32 inode; + large_t file_id; } out; } internal_information; @@ -1685,8 +1681,8 @@ enum search_level {RAW_SEARCH_GENERIC = 0xF000, RAW_SEARCH_FULL_DIRECTORY_INFO = SMB_FIND_FULL_DIRECTORY_INFO, RAW_SEARCH_NAME_INFO = SMB_FIND_NAME_INFO, RAW_SEARCH_BOTH_DIRECTORY_INFO = SMB_FIND_BOTH_DIRECTORY_INFO, - RAW_SEARCH_261 = SMB_FIND_261, - RAW_SEARCH_262 = SMB_FIND_262, + RAW_SEARCH_ID_FULL_DIRECTORY_INFO = SMB_FIND_ID_FULL_DIRECTORY_INFO, + RAW_SEARCH_ID_BOTH_DIRECTORY_INFO = SMB_FIND_ID_BOTH_DIRECTORY_INFO, RAW_SEARCH_UNIX_INFO = SMB_FIND_UNIX_INFO}; @@ -1851,7 +1847,7 @@ union smb_search_data { WIRE_STRING name; } both_directory_info; - /* RAW_SEARCH_261 interface */ + /* RAW_SEARCH_ID_FULL_DIRECTORY_INFO interface */ struct { uint32 file_index; NTTIME create_time; @@ -1862,11 +1858,11 @@ union smb_search_data { large_t alloc_size; uint32 attrib; uint32 ea_size; - uint32 unknown[3]; + large_t file_id; WIRE_STRING name; - } level_261; + } id_full_directory_info; - /* RAW_SEARCH_262 interface */ + /* RAW_SEARCH_ID_BOTH_DIRECTORY_INFO interface */ struct { uint32 file_index; NTTIME create_time; @@ -1877,10 +1873,10 @@ union smb_search_data { large_t alloc_size; uint32 attrib; uint32 ea_size; - uint32 unknown[2]; + large_t file_id; WIRE_STRING short_name; WIRE_STRING name; - } level_262; + } id_both_directory_info; /* RAW_SEARCH_UNIX_INFO interface */ struct { diff --git a/source4/include/trans2.h b/source4/include/trans2.h index 6a629f8989..5c9848f40c 100644 --- a/source4/include/trans2.h +++ b/source4/include/trans2.h @@ -256,8 +256,8 @@ Found 0 aliased levels #define SMB_FIND_FULL_DIRECTORY_INFO 0x102 #define SMB_FIND_NAME_INFO 0x103 #define SMB_FIND_BOTH_DIRECTORY_INFO 0x104 -#define SMB_FIND_261 0x105 -#define SMB_FIND_262 0x106 +#define SMB_FIND_ID_FULL_DIRECTORY_INFO 0x105 +#define SMB_FIND_ID_BOTH_DIRECTORY_INFO 0x106 #define SMB_FIND_UNIX_INFO 0x200 /* flags on trans2 findfirst/findnext that control search */ diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 41fe1225cc..fd66080057 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -173,8 +173,7 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, case RAW_FILEINFO_INTERNAL_INFORMATION: FINFO_CHECK_SIZE(8); - parms->internal_information.out.device = IVAL(blob->data, 0); - parms->internal_information.out.inode = IVAL(blob->data, 4); + parms->internal_information.out.file_id = BVAL(blob->data, 0); return NT_STATUS_OK; case RAW_FILEINFO_ACCESS_INFORMATION: diff --git a/source4/libcli/raw/rawsearch.c b/source4/libcli/raw/rawsearch.c index 222bf53623..430cf925a6 100644 --- a/source4/libcli/raw/rawsearch.c +++ b/source4/libcli/raw/rawsearch.c @@ -362,48 +362,45 @@ static int parse_trans2_search(struct cli_tree *tree, return ofs; - case RAW_SEARCH_261: + case RAW_SEARCH_ID_FULL_DIRECTORY_INFO: if (blob->length < 81) return -1; ofs = IVAL(blob->data, 0); - data->level_261.file_index = IVAL(blob->data, 4); - data->level_261.create_time = cli_pull_nttime(blob->data, 8); - data->level_261.access_time = cli_pull_nttime(blob->data, 16); - data->level_261.write_time = cli_pull_nttime(blob->data, 24); - data->level_261.change_time = cli_pull_nttime(blob->data, 32); - data->level_261.size = BVAL(blob->data, 40); - data->level_261.alloc_size = BVAL(blob->data, 48); - data->level_261.attrib = IVAL(blob->data, 56); - data->level_261.ea_size = IVAL(blob->data, 64); - data->level_261.unknown[0] = IVAL(blob->data, 68); - data->level_261.unknown[1] = IVAL(blob->data, 72); - data->level_261.unknown[2] = IVAL(blob->data, 76); + data->id_full_directory_info.file_index = IVAL(blob->data, 4); + data->id_full_directory_info.create_time = cli_pull_nttime(blob->data, 8); + data->id_full_directory_info.access_time = cli_pull_nttime(blob->data, 16); + data->id_full_directory_info.write_time = cli_pull_nttime(blob->data, 24); + data->id_full_directory_info.change_time = cli_pull_nttime(blob->data, 32); + data->id_full_directory_info.size = BVAL(blob->data, 40); + data->id_full_directory_info.alloc_size = BVAL(blob->data, 48); + data->id_full_directory_info.attrib = IVAL(blob->data, 56); + data->id_full_directory_info.ea_size = IVAL(blob->data, 64); + data->id_full_directory_info.file_id = BVAL(blob->data, 72); len = cli_blob_pull_string(tree->session, mem_ctx, blob, - &data->level_261.name, + &data->id_full_directory_info.name, 60, 80, 0); if (ofs != 0 && ofs < 80+len) { return -1; } return ofs; - case RAW_SEARCH_262: + case RAW_SEARCH_ID_BOTH_DIRECTORY_INFO: if (blob->length < 105) return -1; ofs = IVAL(blob->data, 0); - data->level_262.file_index = IVAL(blob->data, 4); - data->level_262.create_time = cli_pull_nttime(blob->data, 8); - data->level_262.access_time = cli_pull_nttime(blob->data, 16); - data->level_262.write_time = cli_pull_nttime(blob->data, 24); - data->level_262.change_time = cli_pull_nttime(blob->data, 32); - data->level_262.size = BVAL(blob->data, 40); - data->level_262.alloc_size = BVAL(blob->data, 48); - data->level_262.attrib = SVAL(blob->data, 56); - data->level_262.ea_size = IVAL(blob->data, 64); + data->id_both_directory_info.file_index = IVAL(blob->data, 4); + data->id_both_directory_info.create_time = cli_pull_nttime(blob->data, 8); + data->id_both_directory_info.access_time = cli_pull_nttime(blob->data, 16); + data->id_both_directory_info.write_time = cli_pull_nttime(blob->data, 24); + data->id_both_directory_info.change_time = cli_pull_nttime(blob->data, 32); + data->id_both_directory_info.size = BVAL(blob->data, 40); + data->id_both_directory_info.alloc_size = BVAL(blob->data, 48); + data->id_both_directory_info.attrib = SVAL(blob->data, 56); + data->id_both_directory_info.ea_size = IVAL(blob->data, 64); cli_blob_pull_string(tree->session, mem_ctx, blob, - &data->level_262.short_name, + &data->id_both_directory_info.short_name, 68, 70, STR_LEN8BIT | STR_UNICODE); - data->level_262.unknown[0] = IVAL(blob->data, 94); - data->level_262.unknown[1] = IVAL(blob->data, 98); + data->id_both_directory_info.file_id = BVAL(blob->data, 96); len = cli_blob_pull_string(tree->session, mem_ctx, blob, - &data->level_262.name, + &data->id_both_directory_info.name, 60, 104, 0); if (ofs != 0 && ofs < 104+len) { return -1; diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c index def448a671..08c8b88d30 100644 --- a/source4/ntvfs/ntvfs_generic.c +++ b/source4/ntvfs/ntvfs_generic.c @@ -453,8 +453,7 @@ NTSTATUS ntvfs_map_fileinfo(struct request_context *req, union smb_fileinfo *inf return NT_STATUS_OK; case RAW_FILEINFO_INTERNAL_INFORMATION: - info->internal_information.out.device = info2->generic.out.device; - info->internal_information.out.inode = info2->generic.out.inode; + info->internal_information.out.file_id = info2->generic.out.file_id; return NT_STATUS_OK; case RAW_FILEINFO_EA_INFO: diff --git a/source4/ntvfs/simple/svfs_util.c b/source4/ntvfs/simple/svfs_util.c index a8a88cfad0..baa6f86d94 100644 --- a/source4/ntvfs/simple/svfs_util.c +++ b/source4/ntvfs/simple/svfs_util.c @@ -160,3 +160,14 @@ uint16 svfs_unix_to_dos_attrib(mode_t mode) if (!(mode & S_IWUSR)) ret |= FILE_ATTRIBUTE_READONLY; return ret; } + +/* + build a file_id from a stat struct +*/ +large_t svfs_file_id(struct stat *st) +{ + large_t ret = st->st_ino; + ret <<= 32; + ret |= st->st_dev; + return ret; +} diff --git a/source4/ntvfs/simple/vfs_simple.c b/source4/ntvfs/simple/vfs_simple.c index 11763c93b5..c08b36fb39 100644 --- a/source4/ntvfs/simple/vfs_simple.c +++ b/source4/ntvfs/simple/vfs_simple.c @@ -136,8 +136,7 @@ static NTSTATUS svfs_map_fileinfo(struct request_context *req, union smb_fileinf info->generic.out.alloc_size = st->st_blksize * st->st_blocks; info->generic.out.nlink = st->st_nlink; info->generic.out.directory = S_ISDIR(st->st_mode) ? 1 : 0; - info->generic.out.device = st->st_dev; - info->generic.out.inode = st->st_ino; + info->generic.out.file_id = svfs_file_id(st); /* REWRITE: TODO stuff in here */ info->generic.out.delete_pending = 0; info->generic.out.ea_size = 0; diff --git a/source4/smbd/trans2.c b/source4/smbd/trans2.c index 25f4aaed19..0975f77eed 100644 --- a/source4/smbd/trans2.c +++ b/source4/smbd/trans2.c @@ -533,8 +533,7 @@ static NTSTATUS trans2_fileinfo_fill(struct request_context *req, struct smb_tra case RAW_FILEINFO_INTERNAL_INFORMATION: trans2_setup_reply(req, trans, 2, 8, 0); SSVAL(trans->out.params.data, 0, 0); - SIVAL(trans->out.data.data, 0, st->internal_information.out.device); - SIVAL(trans->out.data.data, 4, st->internal_information.out.inode); + SBVAL(trans->out.data.data, 0, st->internal_information.out.file_id); return NT_STATUS_OK; case RAW_FILEINFO_ALL_INFO: @@ -987,49 +986,47 @@ static void find_fill_info(struct request_context *req, SIVAL(data, 0, trans->out.data.length - ofs); break; - case RAW_SEARCH_261: + case RAW_SEARCH_ID_FULL_DIRECTORY_INFO: trans2_grow_data(req, trans, ofs + 80); data = trans->out.data.data + ofs; - SIVAL(data, 4, file->level_261.file_index); - push_nttime(data, 8, &file->level_261.create_time); - push_nttime(data, 16, &file->level_261.access_time); - push_nttime(data, 24, &file->level_261.write_time); - push_nttime(data, 32, &file->level_261.change_time); - SBVAL(data, 40, file->level_261.size); - SBVAL(data, 48, file->level_261.alloc_size); - SIVAL(data, 56, file->level_261.attrib); - SIVAL(data, 64, file->level_261.ea_size); - SIVAL(data, 68, file->level_261.unknown[0]); - SIVAL(data, 72, file->level_261.unknown[1]); - SIVAL(data, 76, file->level_261.unknown[2]); - trans2_append_data_string(req, trans, &file->level_261.name, + SIVAL(data, 4, file->id_full_directory_info.file_index); + push_nttime(data, 8, &file->id_full_directory_info.create_time); + push_nttime(data, 16, &file->id_full_directory_info.access_time); + push_nttime(data, 24, &file->id_full_directory_info.write_time); + push_nttime(data, 32, &file->id_full_directory_info.change_time); + SBVAL(data, 40, file->id_full_directory_info.size); + SBVAL(data, 48, file->id_full_directory_info.alloc_size); + SIVAL(data, 56, file->id_full_directory_info.attrib); + SIVAL(data, 64, file->id_full_directory_info.ea_size); + SIVAL(data, 68, 0); /* padding */ + SBVAL(data, 72, file->id_full_directory_info.file_id); + trans2_append_data_string(req, trans, &file->id_full_directory_info.name, ofs + 60, STR_TERMINATE_ASCII); data = trans->out.data.data + ofs; SIVAL(data, 0, trans->out.data.length - ofs); break; - case RAW_SEARCH_262: + case RAW_SEARCH_ID_BOTH_DIRECTORY_INFO: trans2_grow_data(req, trans, ofs + 104); data = trans->out.data.data + ofs; - SIVAL(data, 4, file->level_262.file_index); - push_nttime(data, 8, &file->level_262.create_time); - push_nttime(data, 16, &file->level_262.access_time); - push_nttime(data, 24, &file->level_262.write_time); - push_nttime(data, 32, &file->level_262.change_time); - SBVAL(data, 40, file->level_262.size); - SBVAL(data, 48, file->level_262.alloc_size); - SIVAL(data, 56, file->level_262.attrib); - SIVAL(data, 64, file->level_262.ea_size); + SIVAL(data, 4, file->id_both_directory_info.file_index); + push_nttime(data, 8, &file->id_both_directory_info.create_time); + push_nttime(data, 16, &file->id_both_directory_info.access_time); + push_nttime(data, 24, &file->id_both_directory_info.write_time); + push_nttime(data, 32, &file->id_both_directory_info.change_time); + SBVAL(data, 40, file->id_both_directory_info.size); + SBVAL(data, 48, file->id_both_directory_info.alloc_size); + SIVAL(data, 56, file->id_both_directory_info.attrib); + SIVAL(data, 64, file->id_both_directory_info.ea_size); SCVAL(data, 69, 0); /* reserved */ memset(data+70,0,24); trans2_push_data_string(req, trans, 68 + ofs, 70 + ofs, - &file->level_262.short_name, + &file->id_both_directory_info.short_name, 24, STR_UNICODE | STR_LEN8BIT); - SIVAL(data, 94, file->level_262.unknown[0]); - SIVAL(data, 98, file->level_262.unknown[1]); + SBVAL(data, 94, file->id_both_directory_info.file_id); SSVAL(data, 102, 0); /* reserved? */ - trans2_append_data_string(req, trans, &file->level_262.name, + trans2_append_data_string(req, trans, &file->id_both_directory_info.name, ofs + 60, STR_TERMINATE_ASCII); data = trans->out.data.data + ofs; SIVAL(data, 0, trans->out.data.length - ofs); diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index e914f98588..cc78aa11f0 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -1290,7 +1290,7 @@ static BOOL handler_ntrename(int instance) parm[0].ntrename.in.old_name = gen_fname(); parm[0].ntrename.in.new_name = gen_fname(); parm[0].ntrename.in.attrib = gen_attrib(); - parm[0].ntrename.in.unknown = gen_bits_mask2(0, 0xFFFFFFF); + parm[0].ntrename.in.cluster_size = gen_bits_mask2(0, 0xFFFFFFF); parm[0].ntrename.in.flags = gen_rename_flags(); GEN_COPY_PARM; @@ -1571,8 +1571,7 @@ static BOOL cmp_fileinfo(int instance, break; case RAW_FILEINFO_INTERNAL_INFORMATION: - CHECK_EQUAL(internal_information.out.device); - CHECK_EQUAL(internal_information.out.inode); + CHECK_EQUAL(internal_information.out.file_id); break; case RAW_FILEINFO_ACCESS_INFORMATION: diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c index 0f7b2dfb63..5d3f543c0f 100644 --- a/source4/torture/raw/qfileinfo.c +++ b/source4/torture/raw/qfileinfo.c @@ -660,8 +660,13 @@ BOOL torture_raw_qfileinfo(int dummy) } \ } while (0) - NAME_PATH_CHECK("INTERNAL_INFORMATION", internal_information, device); - NAME_PATH_CHECK("INTERNAL_INFORMATION", internal_information, inode); + + s1 = fnum_find("INTERNAL_INFORMATION"); + if (s1) { + printf("file_id=%.0f\n", (double)s1->internal_information.out.file_id); + } + + NAME_PATH_CHECK("INTERNAL_INFORMATION", internal_information, file_id); NAME_PATH_CHECK("POSITION_INFORMATION", position_information, position); printf("fnum pos = %.0f, fname pos = %.0f\n", (double)s2->position_information.out.position, diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c index ab69b5af42..301a9f0077 100644 --- a/source4/torture/raw/search.c +++ b/source4/torture/raw/search.c @@ -74,16 +74,16 @@ static struct { NTSTATUS status; union smb_search_data data; } levels[] = { - {"SEARCH", RAW_SEARCH_SEARCH, }, - {"STANDARD", RAW_SEARCH_STANDARD, }, - {"EA_SIZE", RAW_SEARCH_EA_SIZE, }, - {"DIRECTORY_INFO", RAW_SEARCH_DIRECTORY_INFO, }, - {"FULL_DIRECTORY_INFO", RAW_SEARCH_FULL_DIRECTORY_INFO, }, - {"NAME_INFO", RAW_SEARCH_NAME_INFO, }, - {"BOTH_DIRECTORY_INFO", RAW_SEARCH_BOTH_DIRECTORY_INFO, }, - {"LEVEL_261", RAW_SEARCH_261, }, - {"LEVEL_262", RAW_SEARCH_262, }, - {"UNIX_INFO", RAW_SEARCH_UNIX_INFO, CAP_UNIX} + {"SEARCH", RAW_SEARCH_SEARCH, }, + {"STANDARD", RAW_SEARCH_STANDARD, }, + {"EA_SIZE", RAW_SEARCH_EA_SIZE, }, + {"DIRECTORY_INFO", RAW_SEARCH_DIRECTORY_INFO, }, + {"FULL_DIRECTORY_INFO", RAW_SEARCH_FULL_DIRECTORY_INFO, }, + {"NAME_INFO", RAW_SEARCH_NAME_INFO, }, + {"BOTH_DIRECTORY_INFO", RAW_SEARCH_BOTH_DIRECTORY_INFO, }, + {"ID_FULL_DIRECTORY_INFO", RAW_SEARCH_ID_FULL_DIRECTORY_INFO, }, + {"ID_BOTH_DIRECTORY_INFO", RAW_SEARCH_ID_BOTH_DIRECTORY_INFO, }, + {"UNIX_INFO", RAW_SEARCH_UNIX_INFO, CAP_UNIX} }; /* find a level in the table by name */ @@ -109,7 +109,7 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx) const char *fname = "\\torture_search.txt"; NTSTATUS status; int i; - union smb_fileinfo all_info, alt_info, name_info; + union smb_fileinfo all_info, alt_info, name_info, internal_info; union smb_search_data *s; printf("Testing one file searches\n"); @@ -162,6 +162,15 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx) goto done; } + internal_info.generic.level = RAW_FILEINFO_INTERNAL_INFORMATION; + internal_info.generic.in.fname = fname; + status = smb_raw_pathinfo(cli->tree, mem_ctx, &internal_info); + if (!NT_STATUS_IS_OK(status)) { + printf("RAW_FILEINFO_INTERNAL_INFORMATION failed - %s\n", nt_errstr(status)); + ret = False; + goto done; + } + name_info.generic.level = RAW_FILEINFO_NAME_INFO; name_info.generic.in.fname = fname; status = smb_raw_pathinfo(cli->tree, mem_ctx, &name_info); @@ -254,8 +263,8 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx) CHECK_VAL("DIRECTORY_INFO", directory_info, attrib, all_info, all_info, attrib); CHECK_VAL("FULL_DIRECTORY_INFO", full_directory_info, attrib, all_info, all_info, attrib); CHECK_VAL("BOTH_DIRECTORY_INFO", both_directory_info, attrib, all_info, all_info, attrib); - CHECK_VAL("LEVEL_261", level_261, attrib, all_info, all_info, attrib); - CHECK_VAL("LEVEL_262", level_262, attrib, all_info, all_info, attrib); + CHECK_VAL("ID_FULL_DIRECTORY_INFO", id_full_directory_info, attrib, all_info, all_info, attrib); + CHECK_VAL("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, attrib, all_info, all_info, attrib); CHECK_TIME("SEARCH", search, write_time, all_info, all_info, write_time); CHECK_TIME("STANDARD", standard, write_time, all_info, all_info, write_time); @@ -268,26 +277,26 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx) CHECK_NTTIME("DIRECTORY_INFO", directory_info, write_time, all_info, all_info, write_time); CHECK_NTTIME("FULL_DIRECTORY_INFO", full_directory_info, write_time, all_info, all_info, write_time); CHECK_NTTIME("BOTH_DIRECTORY_INFO", both_directory_info, write_time, all_info, all_info, write_time); - CHECK_NTTIME("LEVEL_261", level_261, write_time, all_info, all_info, write_time); - CHECK_NTTIME("LEVEL_262", level_262, write_time, all_info, all_info, write_time); + CHECK_NTTIME("ID_FULL_DIRECTORY_INFO", id_full_directory_info, write_time, all_info, all_info, write_time); + CHECK_NTTIME("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, write_time, all_info, all_info, write_time); CHECK_NTTIME("DIRECTORY_INFO", directory_info, create_time, all_info, all_info, create_time); CHECK_NTTIME("FULL_DIRECTORY_INFO", full_directory_info, create_time, all_info, all_info, create_time); CHECK_NTTIME("BOTH_DIRECTORY_INFO", both_directory_info, create_time, all_info, all_info, create_time); - CHECK_NTTIME("LEVEL_261", level_261, create_time, all_info, all_info, create_time); - CHECK_NTTIME("LEVEL_262", level_262, create_time, all_info, all_info, create_time); + CHECK_NTTIME("ID_FULL_DIRECTORY_INFO", id_full_directory_info, create_time, all_info, all_info, create_time); + CHECK_NTTIME("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, create_time, all_info, all_info, create_time); CHECK_NTTIME("DIRECTORY_INFO", directory_info, access_time, all_info, all_info, access_time); CHECK_NTTIME("FULL_DIRECTORY_INFO", full_directory_info, access_time, all_info, all_info, access_time); CHECK_NTTIME("BOTH_DIRECTORY_INFO", both_directory_info, access_time, all_info, all_info, access_time); - CHECK_NTTIME("LEVEL_261", level_261, access_time, all_info, all_info, access_time); - CHECK_NTTIME("LEVEL_262", level_262, access_time, all_info, all_info, access_time); + CHECK_NTTIME("ID_FULL_DIRECTORY_INFO", id_full_directory_info, access_time, all_info, all_info, access_time); + CHECK_NTTIME("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, access_time, all_info, all_info, access_time); CHECK_NTTIME("DIRECTORY_INFO", directory_info, create_time, all_info, all_info, create_time); CHECK_NTTIME("FULL_DIRECTORY_INFO", full_directory_info, create_time, all_info, all_info, create_time); CHECK_NTTIME("BOTH_DIRECTORY_INFO", both_directory_info, create_time, all_info, all_info, create_time); - CHECK_NTTIME("LEVEL_261", level_261, create_time, all_info, all_info, create_time); - CHECK_NTTIME("LEVEL_262", level_262, create_time, all_info, all_info, create_time); + CHECK_NTTIME("ID_FULL_DIRECTORY_INFO", id_full_directory_info, create_time, all_info, all_info, create_time); + CHECK_NTTIME("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, create_time, all_info, all_info, create_time); CHECK_VAL("SEARCH", search, size, all_info, all_info, size); CHECK_VAL("STANDARD", standard, size, all_info, all_info, size); @@ -295,22 +304,22 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx) CHECK_VAL("DIRECTORY_INFO", directory_info, size, all_info, all_info, size); CHECK_VAL("FULL_DIRECTORY_INFO", full_directory_info, size, all_info, all_info, size); CHECK_VAL("BOTH_DIRECTORY_INFO", both_directory_info, size, all_info, all_info, size); - CHECK_VAL("LEVEL_261", level_261, size, all_info, all_info, size); - CHECK_VAL("LEVEL_262", level_262, size, all_info, all_info, size); + CHECK_VAL("ID_FULL_DIRECTORY_INFO", id_full_directory_info, size, all_info, all_info, size); + CHECK_VAL("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, size, all_info, all_info, size); CHECK_VAL("STANDARD", standard, alloc_size, all_info, all_info, alloc_size); CHECK_VAL("EA_SIZE", ea_size, alloc_size, all_info, all_info, alloc_size); CHECK_VAL("DIRECTORY_INFO", directory_info, alloc_size, all_info, all_info, alloc_size); CHECK_VAL("FULL_DIRECTORY_INFO", full_directory_info, alloc_size, all_info, all_info, alloc_size); CHECK_VAL("BOTH_DIRECTORY_INFO", both_directory_info, alloc_size, all_info, all_info, alloc_size); - CHECK_VAL("LEVEL_261", level_261, alloc_size, all_info, all_info, alloc_size); - CHECK_VAL("LEVEL_262", level_262, alloc_size, all_info, all_info, alloc_size); + CHECK_VAL("ID_FULL_DIRECTORY_INFO", id_full_directory_info, alloc_size, all_info, all_info, alloc_size); + CHECK_VAL("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, alloc_size, all_info, all_info, alloc_size); CHECK_VAL("EA_SIZE", ea_size, ea_size, all_info, all_info, ea_size); CHECK_VAL("FULL_DIRECTORY_INFO", full_directory_info, ea_size, all_info, all_info, ea_size); CHECK_VAL("BOTH_DIRECTORY_INFO", both_directory_info, ea_size, all_info, all_info, ea_size); - CHECK_VAL("LEVEL_261", level_261, ea_size, all_info, all_info, ea_size); - CHECK_VAL("LEVEL_262", level_262, ea_size, all_info, all_info, ea_size); + 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); @@ -321,8 +330,11 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx) 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); CHECK_NAME("BOTH_DIRECTORY_INFO", both_directory_info, name, fname+1, STR_TERMINATE_ASCII); - CHECK_NAME("LEVEL_261", level_261, name, fname+1, STR_TERMINATE_ASCII); - CHECK_NAME("LEVEL_262", level_262, 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_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); diff --git a/source4/torture/raw/setfileinfo.c b/source4/torture/raw/setfileinfo.c index 7645289128..0871d25bc5 100644 --- a/source4/torture/raw/setfileinfo.c +++ b/source4/torture/raw/setfileinfo.c @@ -31,7 +31,7 @@ BOOL torture_raw_sfileinfo(int dummy) struct cli_state *cli; BOOL ret = True; TALLOC_CTX *mem_ctx; - int fnum_saved, fnum2, fnum = -1; + int fnum_saved, d_fnum, fnum2, fnum = -1; char *fnum_fname; char *fnum_fname_new; char *path_fname; @@ -478,6 +478,13 @@ BOOL torture_raw_sfileinfo(int dummy) sfinfo.rename_information.in.new_name = path_fname+strlen(BASEDIR)+1; CHECK_CALL_PATH(RENAME_INFORMATION, NT_STATUS_OK); CHECK_STR(NAME_INFO, name_info, fname.s, path_fname); + + printf("Trying rename with a root fid\n"); + d_fnum = create_directory_handle(cli->tree, BASEDIR); + sfinfo.rename_information.in.new_name = fnum_fname_new+strlen(BASEDIR)+1; + sfinfo.rename_information.in.root_fid = d_fnum; + CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_INVALID_PARAMETER); + CHECK_STR(NAME_INFO, name_info, fname.s, fnum_fname); #endif #if 0 @@ -491,6 +498,7 @@ BOOL torture_raw_sfileinfo(int dummy) #endif done: + smb_raw_exit(cli->session); cli_close(cli, fnum); if (!cli_unlink(cli, fnum_fname)) { printf("Failed to delete %s - %s\n", fnum_fname, cli_errstr(cli)); diff --git a/source4/torture/search.c b/source4/torture/search.c index cf9e28b0fd..766f2adcda 100644 --- a/source4/torture/search.c +++ b/source4/torture/search.c @@ -78,8 +78,8 @@ static struct { {"FULL_DIRECTORY_INFO", RAW_SEARCH_FULL_DIRECTORY_INFO, }, {"NAME_INFO", RAW_SEARCH_NAME_INFO, }, {"BOTH_DIRECTORY_INFO", RAW_SEARCH_BOTH_DIRECTORY_INFO, }, - {"LEVEL_261", RAW_SEARCH_261, }, - {"LEVEL_262", RAW_SEARCH_262, } + {"ID_FULL_DIRECTORY_INFO", RAW_SEARCH_ID_FULL_DIRECTORY_INFO, }, + {"ID_BOTH_DIRECTORY_INFO", RAW_SEARCH_ID_BOTH_DIRECTORY_INFO, } }; /* find a level in the table by name */ @@ -246,8 +246,8 @@ BOOL torture_search(int dummy) CHECK_VAL("DIRECTORY_INFO", directory_info, attrib, all_info, all_info, attrib); CHECK_VAL("FULL_DIRECTORY_INFO", full_directory_info, attrib, all_info, all_info, attrib); CHECK_VAL("BOTH_DIRECTORY_INFO", both_directory_info, attrib, all_info, all_info, attrib); - CHECK_VAL("LEVEL_261", level_261, attrib, all_info, all_info, attrib); - CHECK_VAL("LEVEL_262", level_262, attrib, all_info, all_info, attrib); + CHECK_VAL("ID_FULL_DIRECTORY_INFO", id_full_directory_info, attrib, all_info, all_info, attrib); + CHECK_VAL("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, attrib, all_info, all_info, attrib); CHECK_TIME("SEARCH", search, write_time, all_info, all_info, write_time); CHECK_TIME("STANDARD", standard, write_time, all_info, all_info, write_time); @@ -260,26 +260,26 @@ BOOL torture_search(int dummy) CHECK_NTTIME("DIRECTORY_INFO", directory_info, write_time, all_info, all_info, write_time); CHECK_NTTIME("FULL_DIRECTORY_INFO", full_directory_info, write_time, all_info, all_info, write_time); CHECK_NTTIME("BOTH_DIRECTORY_INFO", both_directory_info, write_time, all_info, all_info, write_time); - CHECK_NTTIME("LEVEL_261", level_261, write_time, all_info, all_info, write_time); - CHECK_NTTIME("LEVEL_262", level_262, write_time, all_info, all_info, write_time); + CHECK_NTTIME("ID_FULL_DIRECTORY_INFO", id_full_directory_info, write_time, all_info, all_info, write_time); + CHECK_NTTIME("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, write_time, all_info, all_info, write_time); CHECK_NTTIME("DIRECTORY_INFO", directory_info, create_time, all_info, all_info, create_time); CHECK_NTTIME("FULL_DIRECTORY_INFO", full_directory_info, create_time, all_info, all_info, create_time); CHECK_NTTIME("BOTH_DIRECTORY_INFO", both_directory_info, create_time, all_info, all_info, create_time); - CHECK_NTTIME("LEVEL_261", level_261, create_time, all_info, all_info, create_time); - CHECK_NTTIME("LEVEL_262", level_262, create_time, all_info, all_info, create_time); + CHECK_NTTIME("ID_FULL_DIRECTORY_INFO", id_full_directory_info, create_time, all_info, all_info, create_time); + CHECK_NTTIME("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, create_time, all_info, all_info, create_time); CHECK_NTTIME("DIRECTORY_INFO", directory_info, access_time, all_info, all_info, access_time); CHECK_NTTIME("FULL_DIRECTORY_INFO", full_directory_info, access_time, all_info, all_info, access_time); CHECK_NTTIME("BOTH_DIRECTORY_INFO", both_directory_info, access_time, all_info, all_info, access_time); - CHECK_NTTIME("LEVEL_261", level_261, access_time, all_info, all_info, access_time); - CHECK_NTTIME("LEVEL_262", level_262, access_time, all_info, all_info, access_time); + CHECK_NTTIME("ID_FULL_DIRECTORY_INFO", id_full_directory_info, access_time, all_info, all_info, access_time); + CHECK_NTTIME("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, access_time, all_info, all_info, access_time); CHECK_NTTIME("DIRECTORY_INFO", directory_info, create_time, all_info, all_info, create_time); CHECK_NTTIME("FULL_DIRECTORY_INFO", full_directory_info, create_time, all_info, all_info, create_time); CHECK_NTTIME("BOTH_DIRECTORY_INFO", both_directory_info, create_time, all_info, all_info, create_time); - CHECK_NTTIME("LEVEL_261", level_261, create_time, all_info, all_info, create_time); - CHECK_NTTIME("LEVEL_262", level_262, create_time, all_info, all_info, create_time); + CHECK_NTTIME("ID_FULL_DIRECTORY_INFO", id_full_directory_info, create_time, all_info, all_info, create_time); + CHECK_NTTIME("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, create_time, all_info, all_info, create_time); CHECK_VAL("SEARCH", search, size, all_info, all_info, size); CHECK_VAL("STANDARD", standard, size, all_info, all_info, size); @@ -287,21 +287,21 @@ BOOL torture_search(int dummy) CHECK_VAL("DIRECTORY_INFO", directory_info, size, all_info, all_info, size); CHECK_VAL("FULL_DIRECTORY_INFO", full_directory_info, size, all_info, all_info, size); CHECK_VAL("BOTH_DIRECTORY_INFO", both_directory_info, size, all_info, all_info, size); - CHECK_VAL("LEVEL_261", level_261, size, all_info, all_info, size); - CHECK_VAL("LEVEL_262", level_262, size, all_info, all_info, size); + CHECK_VAL("ID_FULL_DIRECTORY_INFO", id_full_directory_info, size, all_info, all_info, size); + CHECK_VAL("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, size, all_info, all_info, size); CHECK_VAL("STANDARD", standard, alloc_size, all_info, all_info, alloc_size); CHECK_VAL("EA_SIZE", ea_size, alloc_size, all_info, all_info, alloc_size); CHECK_VAL("DIRECTORY_INFO", directory_info, alloc_size, all_info, all_info, alloc_size); CHECK_VAL("FULL_DIRECTORY_INFO", full_directory_info, alloc_size, all_info, all_info, alloc_size); CHECK_VAL("BOTH_DIRECTORY_INFO", both_directory_info, alloc_size, all_info, all_info, alloc_size); - CHECK_VAL("LEVEL_261", level_261, alloc_size, all_info, all_info, alloc_size); - CHECK_VAL("LEVEL_262", level_262, alloc_size, all_info, all_info, alloc_size); + CHECK_VAL("ID_FULL_DIRECTORY_INFO", id_full_directory_info, alloc_size, all_info, all_info, alloc_size); + CHECK_VAL("ID_BOTH_DIRECTORY_INFO", id_both_directory_info, alloc_size, all_info, all_info, alloc_size); CHECK_VAL("EA_SIZE", ea_size, ea_size, all_info, all_info, ea_size); CHECK_VAL("FULL_DIRECTORY_INFO", full_directory_info, ea_size, all_info, all_info, ea_size); - CHECK_VAL("LEVEL_261", level_261, ea_size, all_info, all_info, ea_size); - CHECK_VAL("LEVEL_262", level_262, ea_size, all_info, all_info, ea_size); + 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); @@ -312,8 +312,8 @@ BOOL torture_search(int dummy) 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); CHECK_NAME("BOTH_DIRECTORY_INFO", both_directory_info, name, fname+1, STR_TERMINATE_ASCII); - CHECK_NAME("LEVEL_261", level_261, name, fname+1, STR_TERMINATE_ASCII); - CHECK_NAME("LEVEL_262", level_262, 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); done: cli_close(cli, fnum); diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c index 2dea3039aa..27c2892c47 100644 --- a/source4/torture/torture_util.c +++ b/source4/torture/torture_util.c @@ -39,7 +39,7 @@ double end_timer(void) /* create a directory, returning a handle to it */ -int create_directory_handle(struct cli_state *cli, const char *dname) +int create_directory_handle(struct cli_tree *tree, const char *dname) { NTSTATUS status; union smb_open io; @@ -60,7 +60,7 @@ int create_directory_handle(struct cli_state *cli, const char *dname) io.ntcreatex.in.security_flags = 0; io.ntcreatex.in.fname = dname; - status = smb_raw_open(cli->tree, mem_ctx, &io); + status = smb_raw_open(tree, mem_ctx, &io); if (!NT_STATUS_IS_OK(status)) { talloc_destroy(mem_ctx); return -1; |