diff options
author | Ralph Boehme <slow@samba.org> | 2023-11-04 14:11:15 +0100 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2023-11-04 19:29:34 +0000 |
commit | 743a9b3b0e11623d1a3204751cdf5f3ad1d6fa48 (patch) | |
tree | fe9553ba91c2b61a2f550be3fcde48752f4cc606 | |
parent | 1646b2a3be90d4b4a72b5463aa8e74089c2041f5 (diff) |
SMB2: add SMB2_FILE_LINK_INFO
MS-FSCC 2.4.23.2 FileLinkInformation
Signed-off-by: Ralph Boehme <slow@samba.org>
-rw-r--r-- | epan/dissectors/packet-smb2.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c index b9b7eb9604..46eded91df 100644 --- a/epan/dissectors/packet-smb2.c +++ b/epan/dissectors/packet-smb2.c @@ -201,6 +201,7 @@ static int hf_smb2_file_internal_info = -1; static int hf_smb2_file_ea_info = -1; static int hf_smb2_file_access_info = -1; static int hf_smb2_file_rename_info = -1; +static int hf_smb2_file_link_info = -1; static int hf_smb2_file_disposition_info = -1; static int hf_smb2_file_position_info = -1; static int hf_smb2_file_full_ea_info = -1; @@ -687,6 +688,7 @@ static gint ett_smb2_file_compression_info = -1; static gint ett_smb2_file_network_open_info = -1; static gint ett_smb2_file_attribute_tag_info = -1; static gint ett_smb2_file_rename_info = -1; +static gint ett_smb2_file_link_info = -1; static gint ett_smb2_file_disposition_info = -1; static gint ett_smb2_file_full_ea_info = -1; static gint ett_smb2_file_normalized_name_info = -1; @@ -859,6 +861,7 @@ static const value_string smb2_share_type_vals[] = { #define SMB2_FILE_EA_INFO 0x07 #define SMB2_FILE_ACCESS_INFO 0x08 #define SMB2_FILE_RENAME_INFO 0x0a +#define SMB2_FILE_LINK_INFO 0x0b #define SMB2_FILE_DISPOSITION_INFO 0x0d #define SMB2_FILE_POSITION_INFO 0x0e #define SMB2_FILE_FULL_EA_INFO 0x0f @@ -883,6 +886,7 @@ static const value_string smb2_file_info_levels[] = { {SMB2_FILE_EA_INFO, "SMB2_FILE_EA_INFO" }, {SMB2_FILE_ACCESS_INFO, "SMB2_FILE_ACCESS_INFO" }, {SMB2_FILE_RENAME_INFO, "SMB2_FILE_RENAME_INFO" }, + {SMB2_FILE_LINK_INFO, "SMB2_FILE_LINK_INFO" }, {SMB2_FILE_DISPOSITION_INFO, "SMB2_FILE_DISPOSITION_INFO" }, {SMB2_FILE_POSITION_INFO, "SMB2_FILE_POSITION_INFO" }, {SMB2_FILE_FULL_EA_INFO, "SMB2_FILE_FULL_EA_INFO" }, @@ -3182,6 +3186,52 @@ dissect_smb2_file_rename_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *par } static int +dissect_smb2_file_link_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) +{ + proto_item *item = NULL; + proto_tree *tree = NULL; + int length; + char *display_string = NULL; + + + if (parent_tree) { + item = proto_tree_add_item(parent_tree, hf_smb2_file_link_info, tvb, offset, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_smb2_file_link_info); + } + + /* ReplaceIfExists */ + proto_tree_add_item(tree, hf_smb2_replace_if, tvb, offset, 1, ENC_NA); + offset += 1; + + /* reserved */ + proto_tree_add_item(tree, hf_smb2_reserved_random, tvb, offset, 7, ENC_NA); + offset += 7; + + /* Root Directory Handle, MBZ */ + proto_tree_add_item(tree, hf_smb2_root_directory_mbz, tvb, offset, 8, ENC_NA); + offset += 8; + + /* file name length */ + length = tvb_get_letohs(tvb, offset); + proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 4, ENC_LITTLE_ENDIAN); + offset += 4; + + /* file name */ + if (length < 1) { + return offset; + } + + proto_tree_add_item_ret_display_string(tree, hf_smb2_filename, + tvb, offset, length, ENC_UTF_16|ENC_LITTLE_ENDIAN, + pinfo->pool, &display_string); + col_append_fstr(pinfo->cinfo, COL_INFO, " NewLink:%s", + display_string); + offset += length; + + return offset; +} + +static int dissect_smb2_sec_info_00(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) { proto_item *item = NULL; @@ -5887,6 +5937,9 @@ dissect_smb2_infolevel(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, case SMB2_FILE_RENAME_INFO: offset = dissect_smb2_file_rename_info(tvb, pinfo, tree, offset, si); break; + case SMB2_FILE_LINK_INFO: + offset = dissect_smb2_file_link_info(tvb, pinfo, tree, offset, si); + break; case SMB2_FILE_DISPOSITION_INFO: offset = dissect_smb2_file_disposition_info(tvb, pinfo, tree, offset, si); break; @@ -11995,6 +12048,11 @@ proto_register_smb2(void) NULL, 0, NULL, HFILL } }, + { &hf_smb2_file_link_info, + { "SMB2_FILE_LINK_INFO", "smb2.file_link_info", FT_NONE, BASE_NONE, + NULL, 0, NULL, HFILL } + }, + { &hf_smb2_fs_info_01, { "FileFsVolumeInformation", "smb2.fs_volume_info", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } @@ -14071,6 +14129,7 @@ proto_register_smb2(void) &ett_smb2_file_ea_info, &ett_smb2_file_access_info, &ett_smb2_file_rename_info, + &ett_smb2_file_link_info, &ett_smb2_file_disposition_info, &ett_smb2_file_position_info, &ett_smb2_file_full_ea_info, |