Commit 63e707b0 authored by Stefan Metzmacher's avatar Stefan Metzmacher Committed by Ben Hutchings

fs/cifs: correctly to anonymous authentication for the LANMAN authentication

commit fa8f3a35 upstream.

Only server which map unknown users to guest will allow
access using a non-null LMChallengeResponse.

For Samba it's the "map to guest = bad user" option.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11913Signed-off-by: default avatarStefan Metzmacher <metze@samba.org>
Signed-off-by: default avatarSteve French <smfrench@gmail.com>
[bwh: Backported to 3.16: adjust context, indentation]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent c764ef67
...@@ -632,22 +632,24 @@ CIFS_SessSetup(const unsigned int xid, struct cifs_ses *ses, ...@@ -632,22 +632,24 @@ CIFS_SessSetup(const unsigned int xid, struct cifs_ses *ses,
pSMB->req.hdr.Flags2 &= ~SMBFLG2_UNICODE; pSMB->req.hdr.Flags2 &= ~SMBFLG2_UNICODE;
/* no capabilities flags in old lanman negotiation */ if (ses->user_name != NULL) {
/* no capabilities flags in old lanman negotiation */
pSMB->old_req.PasswordLength = cpu_to_le16(CIFS_AUTH_RESP_SIZE); pSMB->old_req.PasswordLength = cpu_to_le16(CIFS_AUTH_RESP_SIZE);
/* Calculate hash with password and copy into bcc_ptr. /* Calculate hash with password and copy into bcc_ptr.
* Encryption Key (stored as in cryptkey) gets used if the * Encryption Key (stored as in cryptkey) gets used if the
* security mode bit in Negottiate Protocol response states * security mode bit in Negottiate Protocol response states
* to use challenge/response method (i.e. Password bit is 1). * to use challenge/response method (i.e. Password bit is 1).
*/ */
rc = calc_lanman_hash(ses->password, ses->server->cryptkey,
rc = calc_lanman_hash(ses->password, ses->server->cryptkey, ses->server->sec_mode & SECMODE_PW_ENCRYPT ?
ses->server->sec_mode & SECMODE_PW_ENCRYPT ? true : false, lnm_session_key);
true : false, lnm_session_key);
memcpy(bcc_ptr, (char *)lnm_session_key, CIFS_AUTH_RESP_SIZE);
memcpy(bcc_ptr, (char *)lnm_session_key, CIFS_AUTH_RESP_SIZE); bcc_ptr += CIFS_AUTH_RESP_SIZE;
bcc_ptr += CIFS_AUTH_RESP_SIZE; } else {
pSMB->old_req.PasswordLength = 0;
}
/* can not sign if LANMAN negotiated so no need /* can not sign if LANMAN negotiated so no need
to calculate signing key? but what if server to calculate signing key? but what if server
......
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