]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
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)
committerKarolin Seeger <kseeger@samba.org>
Fri, 26 Jun 2020 07:52:26 +0000 (07:52 +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>
(cherry picked from commit 3063e1601ad9e2536651a75a47ebf4921ffddbdc)

source3/libsmb/cli_smb2_fnum.c

index 8c8b33f49edb1df3c1734b9226598fdc52ebb079..4edeefc117db7e0a2a1475455cc76125dc9f4e21 100644 (file)
@@ -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)) {