s3: libsmb: Info level SMB2_FIND_ID_BOTH_DIRECTORY_INFO encodes attibutes as a uint32...
authorJeremy Allison <jra@samba.org>
Mon, 1 Jun 2020 20:55:10 +0000 (13:55 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 3 Jun 2020 04:54:38 +0000 (04:54 +0000)
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>
source3/libsmb/cli_smb2_fnum.c

index c1c755a97ea836bced4646a3497aec27f340f438..46a4ae95977d43a8fd65bf88f29f4d2d36abcdc7 100644 (file)
@@ -1199,7 +1199,8 @@ static NTSTATUS parse_finfo_id_both_directory_info(const 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)) {