From 085ff186f2a9257dff66844ba00fa2b1454bad4d Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Wed, 26 Feb 2020 16:55:40 -0600
Subject: [PATCH 2/2] smb3: update the information returned on posix
create/open
Fix a couple minor problems with parsing the create context in
the previous patch (length incorrect in one, and field
name incorrect in one othe replace). And account for sids
in the create posix response.
Signed-off-by: Steve French <stfrench@microsoft.com>
---
fs/cifs/smb2pdu.c | 4 ++--
fs/cifs/smb2pdu.h | 12 +++++++-----
2 files changed, 9 insertions(+), 7 deletions(-)
@@ -1955,7 +1955,7 @@ parse_posix_ctxt(struct create_context *cc, struct smb2_file_all_info *info,
struct create_posix_rsp *posix)
{
int sid_len;
- u8 *beg = (u8 *)cc + le32_to_cpu(cc->DataOffset);
+ u8 *beg = (u8 *)cc + le16_to_cpu(cc->DataOffset);
u8 *end = beg + le32_to_cpu(cc->DataLength);
u8 *sid;
@@ -1963,7 +1963,7 @@ parse_posix_ctxt(struct create_context *cc, struct smb2_file_all_info *info,
posix->nlink = le32_to_cpu(*(__le32 *)(beg + 0));
posix->reparse_tag = le32_to_cpu(*(__le32 *)(beg + 4));
- posix->reparse_tag = le32_to_cpu(*(__le32 *)(beg + 8));
+ posix->mode = le32_to_cpu(*(__le32 *)(beg + 8));
sid = beg + 12;
sid_len = posix_info_sid_size(sid, end);
@@ -1603,16 +1603,18 @@ struct smb2_file_id_information {
extern char smb2_padding[7];
-/* equivalent of the contents of SMB3.1.1 POSIX open context response */
+/* unpacked equivalent of contents of SMB3.1.1 POSIX open context response */
struct create_posix_rsp {
- __le32 nlink;
- __le32 reparse_tag;
- __le32 mode;
+ u32 nlink;
+ u32 reparse_tag;
+ u32 mode;
/*
* var sized owner SID
* var sized group SID
*/
-} __packed;
+ struct cifs_sid owner;
+ struct cifs_sid group;
+};
/*
* SMB2-only POSIX info level
--
2.20.1