Skip to content

Commit ab3459d

Browse files
committed
smb3: print warning once if posix context returned on open
SMB3.1.1 POSIX Context processing is not complete yet - so print warning (once) if server returns it on open. Signed-off-by: Steve French <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]>
1 parent 2391ca4 commit ab3459d

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

fs/cifs/smb2pdu.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,6 +1939,16 @@ parse_query_id_ctxt(struct create_context *cc, struct smb2_file_all_info *buf)
19391939
buf->IndexNumber = pdisk_id->DiskFileId;
19401940
}
19411941

1942+
static void
1943+
parse_posix_ctxt(struct create_context *cc, struct smb_posix_info *pposix_inf)
1944+
{
1945+
/* struct smb_posix_info *ppinf = (struct smb_posix_info *)cc; */
1946+
1947+
/* TODO: Need to add parsing for the context and return */
1948+
printk_once(KERN_WARNING
1949+
"SMB3 3.11 POSIX response context not completed yet\n");
1950+
}
1951+
19421952
void
19431953
smb2_parse_contexts(struct TCP_Server_Info *server,
19441954
struct smb2_create_rsp *rsp,
@@ -1950,6 +1960,9 @@ smb2_parse_contexts(struct TCP_Server_Info *server,
19501960
unsigned int next;
19511961
unsigned int remaining;
19521962
char *name;
1963+
const char smb3_create_tag_posix[] = {0x93, 0xAD, 0x25, 0x50, 0x9C,
1964+
0xB4, 0x11, 0xE7, 0xB4, 0x23, 0x83,
1965+
0xDE, 0x96, 0x8B, 0xCD, 0x7C};
19531966

19541967
*oplock = 0;
19551968
data_offset = (char *)rsp + le32_to_cpu(rsp->CreateContextsOffset);
@@ -1969,6 +1982,15 @@ smb2_parse_contexts(struct TCP_Server_Info *server,
19691982
else if (buf && (le16_to_cpu(cc->NameLength) == 4) &&
19701983
strncmp(name, SMB2_CREATE_QUERY_ON_DISK_ID, 4) == 0)
19711984
parse_query_id_ctxt(cc, buf);
1985+
else if ((le16_to_cpu(cc->NameLength) == 16)) {
1986+
if (memcmp(name, smb3_create_tag_posix, 16) == 0)
1987+
parse_posix_ctxt(cc, NULL);
1988+
}
1989+
/* else {
1990+
cifs_dbg(FYI, "Context not matched with len %d\n",
1991+
le16_to_cpu(cc->NameLength));
1992+
cifs_dump_mem("Cctxt name: ", name, 4);
1993+
} */
19721994

19731995
next = le32_to_cpu(cc->Next);
19741996
if (!next)

fs/cifs/smb2pdu.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,4 +1595,12 @@ struct smb2_file_network_open_info {
15951595

15961596
extern char smb2_padding[7];
15971597

1598+
/* equivalent of the contents of SMB3.1.1 POSIX open context response */
1599+
struct smb_posix_info {
1600+
__le32 nlink;
1601+
__le32 reparse_tag;
1602+
__le32 mode;
1603+
kuid_t uid;
1604+
kuid_t gid;
1605+
};
15981606
#endif /* _SMB2PDU_H */

0 commit comments

Comments
 (0)