From dae5f88339015f061428f3dbdf8936ee1b259e26 Mon Sep 17 00:00:00 2001 From: Uri Simchoni Date: Thu, 1 Sep 2016 23:52:40 +0300 Subject: [PATCH] SMB: dissect FILE_GET_QUOTA_INFORMATION Add a function that dissects FILE_GET_QUOTA_INFORMATION structure ([MS-FSCC] 2.4.33.1) This structure is used to define a set of SIDs whose quota is to be fetched. Change-Id: I81f6bca98fb239935ca593bd8725cebbb2037fbe Signed-off-by: Uri Simchoni Reviewed-on: https://code.wireshark.org/review/17445 Petri-Dish: Anders Broman Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-smb.c | 34 ++++++++++++++++++++++++++++++++++ epan/dissectors/packet-smb.h | 1 + 2 files changed, 35 insertions(+) diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index 076992cfc9..dae5abfd09 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -8312,6 +8312,40 @@ dissect_nt_user_quota(tvbuff_t *tvb, proto_tree *tree, int offset, guint16 *bcp) } +int +dissect_nt_get_user_quota(tvbuff_t *tvb, proto_tree *tree, int offset, guint32 *bcp) +{ + int old_offset, old_sid_offset; + guint32 qsize; + + do { + old_offset = offset; + + CHECK_BYTE_COUNT_TRANS_SUBR(4); + qsize = tvb_get_letohl(tvb, offset); + proto_tree_add_uint(tree, hf_smb_user_quota_offset, tvb, offset, 4, qsize); + COUNT_BYTES_TRANS_SUBR(4); + + CHECK_BYTE_COUNT_TRANS_SUBR(4); + /* length of SID */ + proto_tree_add_item(tree, hf_smb_length_of_sid, tvb, offset, 4, ENC_LITTLE_ENDIAN); + COUNT_BYTES_TRANS_SUBR(4); + + /* SID of the user */ + old_sid_offset = offset; + offset = dissect_nt_sid(tvb, offset, tree, "SID", NULL, -1); + *bcp -= (offset-old_sid_offset); + + if (qsize) { + offset = old_offset+qsize; + } + }while (qsize); + + + return offset; +} + + static int dissect_nt_trans_data_request(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *parent_tree, int bc, nt_trans_data *ntd, smb_nt_transact_info_t *nti, smb_info_t *si) { diff --git a/epan/dissectors/packet-smb.h b/epan/dissectors/packet-smb.h index 146065503c..7616582d61 100644 --- a/epan/dissectors/packet-smb.h +++ b/epan/dissectors/packet-smb.h @@ -363,6 +363,7 @@ extern int dissect_qfsi_FS_DEVICE_INFO(tvbuff_t * tvb, packet_info * pinfo, prot extern int dissect_qfsi_FS_ATTRIBUTE_INFO(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, int offset, guint16 *bcp, int unicode); extern int dissect_nt_quota(tvbuff_t *tvb, proto_tree *tree, int offset, guint16 *bcp); extern int dissect_nt_user_quota(tvbuff_t *tvb, proto_tree *tree, int offset, guint16 *bcp); +extern int dissect_nt_get_user_quota(tvbuff_t *tvb, proto_tree *tree, int offset, guint32 *bcp); extern int dissect_qfsi_FS_OBJECTID_INFO(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, int offset, guint16 *bcp); extern int dissect_qfsi_FS_FULL_SIZE_INFO(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, int offset, guint16 *bcp); extern int dissect_qfi_SMB_FILE_EA_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 *bcp, gboolean *trunc);