Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1462243

[PATCH 3.16 093/305] fs/cifs: correctly to anonymous authentication for the LANMAN authentication

Path csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Ben Hutchings <ben@decadent.org.uk>
Newsgroups linux.kernel
Subject [PATCH 3.16 093/305] fs/cifs: correctly to anonymous authentication for the LANMAN authentication
Date Sun, 14 Aug 2016 20:10:03 +0200
Message-ID <s681d-31c-63@gated-at.bofh.it> (permalink)
References <s5LnX-4sk-3@gated-at.bofh.it>
Content-Type text/plain; charset="UTF-8"
Content-Disposition inline
Content-Transfer-Encoding 8bit
MIME-Version 1.0
X-Mailer LinuxStableQueue (scripts by bwh)
X-Sa-Exim-Connect-IP 92.40.249.202
X-Sa-Exim-Mail-From ben@decadent.org.uk
X-Sa-Exim-Scanned No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 63
Organization linux.* mail to news gateway
X-Original-Cc akpm@linux-foundation.org, "Stefan Metzmacher" <metze@samba.org>, "Steve French" <smfrench@gmail.com>
X-Original-Date Sat, 13 Aug 2016 18:42:51 +0100
X-Original-Message-ID <lsq.1471110171.879048128@decadent.org.uk>
X-Original-References <lsq.1471110169.907390585@decadent.org.uk>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1462243

Show key headers only | View raw


3.16.37-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Stefan Metzmacher <metze@samba.org>

commit fa8f3a354bb775ec586e4475bcb07f7dece97e0c 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=11913

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
[bwh: Backported to 3.16: adjust context, indentation]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -632,22 +632,24 @@ ssetup_ntlmssp_authenticate:
 
 		pSMB->req.hdr.Flags2 &= ~SMBFLG2_UNICODE;
 
-		/* no capabilities flags in old lanman negotiation */
-
-		pSMB->old_req.PasswordLength = cpu_to_le16(CIFS_AUTH_RESP_SIZE);
-
-		/* Calculate hash with password and copy into bcc_ptr.
-		 * Encryption Key (stored as in cryptkey) gets used if the
-		 * security mode bit in Negottiate Protocol response states
-		 * to use challenge/response method (i.e. Password bit is 1).
-		 */
-
-		rc = calc_lanman_hash(ses->password, ses->server->cryptkey,
-				 ses->server->sec_mode & SECMODE_PW_ENCRYPT ?
-					true : false, lnm_session_key);
-
-		memcpy(bcc_ptr, (char *)lnm_session_key, CIFS_AUTH_RESP_SIZE);
-		bcc_ptr += CIFS_AUTH_RESP_SIZE;
+		if (ses->user_name != NULL) {
+			/* no capabilities flags in old lanman negotiation */
+			pSMB->old_req.PasswordLength = cpu_to_le16(CIFS_AUTH_RESP_SIZE);
+
+			/* Calculate hash with password and copy into bcc_ptr.
+			 * Encryption Key (stored as in cryptkey) gets used if the
+			 * security mode bit in Negottiate Protocol response states
+			 * to use challenge/response method (i.e. Password bit is 1).
+			 */
+			rc = calc_lanman_hash(ses->password, ses->server->cryptkey,
+					      ses->server->sec_mode & SECMODE_PW_ENCRYPT ?
+					      true : false, lnm_session_key);
+
+			memcpy(bcc_ptr, (char *)lnm_session_key, 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
 		to calculate signing key? but what if server

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 3.16 093/305] fs/cifs: correctly to anonymous  authentication for the LANMAN authentication Ben Hutchings <ben@decadent.org.uk> - 2016-08-14 20:10 +0200

csiph-web