summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2020-06-01 13:55:10 -0700
committerKarolin Seeger <kseeger@samba.org>2020-06-26 07:52:26 +0000
commit10e8d8b4b13a7d1bbd07072a8ebd178ca12b9641 (patch)
tree888531b3295314092048a2cb9e36ed71700d5671
parent1f8a77fe3aaebb15f3c71e6d3a46e2ef15590b29 (diff)
downloadsamba-10e8d8b4b13a7d1bbd07072a8ebd178ca12b9641.tar.gz
s3: libsmb: Info level SMB2_FIND_ID_BOTH_DIRECTORY_INFO encodes attibutes as a uint32, not a uint8.
Fix the SMB2 parsing code. Cast to a uint16_t for now after pulling the information as finfo->mode is currently only 16 bits. We will need this to detect FILE_ATTRIBUTE_REPARSE_POINT in a later commit. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit 3063e1601ad9e2536651a75a47ebf4921ffddbdc)
-rw-r--r--source3/libsmb/cli_smb2_fnum.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
index 8c8b33f49ed..4edeefc117d 100644
--- a/source3/libsmb/cli_smb2_fnum.c
+++ b/source3/libsmb/cli_smb2_fnum.c
@@ -1236,7 +1236,8 @@ static NTSTATUS parse_finfo_id_both_directory_info(uint8_t *dir_data,
finfo->ctime_ts = interpret_long_date((const char *)dir_data + 32);
finfo->size = IVAL2_TO_SMB_BIG_UINT(dir_data + 40, 0);
finfo->allocated_size = IVAL2_TO_SMB_BIG_UINT(dir_data + 48, 0);
- finfo->mode = CVAL(dir_data + 56, 0);
+ /* NB. We need to enlarge finfo->mode to be 32-bits. */
+ finfo->mode = (uint16_t)IVAL(dir_data + 56, 0);
finfo->ino = IVAL2_TO_SMB_BIG_UINT(dir_data + 96, 0);
namelen = IVAL(dir_data + 60,0);
if (namelen > (dir_data_length - 104)) {