Skip to content

Commit 5fde3c2

Browse files
Marios MakassikisSteve French
authored andcommitted
ksmbd: do not sign response to session request for guest login
If ksmbd.mountd is configured to assign unknown users to the guest account ("map to guest = bad user" in the config), ksmbd signs the response. This is wrong according to MS-SMB2 3.3.5.5.3: 12. If the SMB2_SESSION_FLAG_IS_GUEST bit is not set in the SessionFlags field, and Session.IsAnonymous is FALSE, the server MUST sign the final session setup response before sending it to the client, as follows: [...] This fixes libsmb2 based applications failing to establish a session ("Wrong signature in received"). Fixes: e2f3448 ("cifsd: add server-side procedures for SMB3") Cc: [email protected] Signed-off-by: Marios Makassikis <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 0d0d468 commit 5fde3c2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/ksmbd/smb2pdu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8663,6 +8663,7 @@ int smb3_decrypt_req(struct ksmbd_work *work)
86638663
bool smb3_11_final_sess_setup_resp(struct ksmbd_work *work)
86648664
{
86658665
struct ksmbd_conn *conn = work->conn;
8666+
struct ksmbd_session *sess = work->sess;
86668667
struct smb2_hdr *rsp = smb2_get_msg(work->response_buf);
86678668

86688669
if (conn->dialect < SMB30_PROT_ID)
@@ -8672,6 +8673,7 @@ bool smb3_11_final_sess_setup_resp(struct ksmbd_work *work)
86728673
rsp = ksmbd_resp_buf_next(work);
86738674

86748675
if (le16_to_cpu(rsp->Command) == SMB2_SESSION_SETUP_HE &&
8676+
sess->user && !user_guest(sess->user) &&
86758677
rsp->Status == STATUS_SUCCESS)
86768678
return true;
86778679
return false;

0 commit comments

Comments
 (0)