Commit d7c93170 authored by Steve French's avatar Steve French Committed by Ben Hutchings

Set previous session id correctly on SMB3 reconnect

commit c2afb814 upstream.
Signed-off-by: default avatarSteve French <steve.french@primarydata.com>
Reported-by: default avatarDavid Goebel <davidgoe@microsoft.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 47aa7c01
...@@ -566,6 +566,7 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses, ...@@ -566,6 +566,7 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses,
char *security_blob; char *security_blob;
unsigned char *ntlmssp_blob = NULL; unsigned char *ntlmssp_blob = NULL;
bool use_spnego = false; /* else use raw ntlmssp */ bool use_spnego = false; /* else use raw ntlmssp */
u64 previous_session = ses->Suid;
cifs_dbg(FYI, "Session Setup\n"); cifs_dbg(FYI, "Session Setup\n");
...@@ -602,6 +603,10 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses, ...@@ -602,6 +603,10 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses,
return rc; return rc;
req->hdr.SessionId = 0; /* First session, not a reauthenticate */ req->hdr.SessionId = 0; /* First session, not a reauthenticate */
/* if reconnect, we need to send previous sess id, otherwise it is 0 */
req->PreviousSessionId = previous_session;
req->VcNumber = 0; /* MBZ */ req->VcNumber = 0; /* MBZ */
/* to enable echos and oplocks */ /* to enable echos and oplocks */
req->hdr.CreditRequest = cpu_to_le16(3); req->hdr.CreditRequest = cpu_to_le16(3);
......
...@@ -245,7 +245,7 @@ struct smb2_sess_setup_req { ...@@ -245,7 +245,7 @@ struct smb2_sess_setup_req {
__le32 Channel; __le32 Channel;
__le16 SecurityBufferOffset; __le16 SecurityBufferOffset;
__le16 SecurityBufferLength; __le16 SecurityBufferLength;
__le64 PreviousSessionId; __u64 PreviousSessionId;
__u8 Buffer[1]; /* variable length GSS security buffer */ __u8 Buffer[1]; /* variable length GSS security buffer */
} __packed; } __packed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment