Skip to contentSkip to conversation

cifs: Support NTLM2 session security during NTLMSSP authentication [try #2]

PATCH In review [email protected] 2 participants 2 messages Dec 8, 2010 – Dec 9, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: Support NTLM2 session security during NTLMSSP authentication [try #2]

From: Shirish Pargaonkar <[email protected]>

Indicate to the server a capability of NTLM2 session security (NTLM2 Key) during ntlmssp protocol exchange in one of the bits of the flags field. If server supports this capability, send NTLM2 key even if signing is not required on the server.
If the server requires signing, the session keys exchanged for NTLMv2 and NTLM2 session security in auth packet of the nlmssp exchange are same.

---
 fs/cifs/sess.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
fs/cifs/sess.c +4 -3
index 7b01d3f..44c2989 100644
@@ -437,7 +437,7 @@ static void build_ntlmssp_negotiate_blob(unsigned char *pbuffer,
 	/* BB is NTLMV2 session security format easier to use here? */
 	flags = NTLMSSP_NEGOTIATE_56 |	NTLMSSP_REQUEST_TARGET |
 		NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE |
-		NTLMSSP_NEGOTIATE_NTLM;
+		NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC;
 	if (ses->server->secMode &
 			(SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) {
 		flags |= NTLMSSP_NEGOTIATE_SIGN;
@@ -544,8 +544,9 @@ static int build_ntlmssp_auth_blob(unsigned char *pbuffer,
 	sec_blob->WorkstationName.MaximumLength = 0;
 	tmp += 2;
 
-	if ((ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_KEY_XCH) &&
-			!calc_seckey(ses)) {
+	if (((ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_KEY_XCH) ||
+		(ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_EXTENDED_SEC))
+			&& !calc_seckey(ses)) {
 		memcpy(tmp, ses->ntlmssp->ciphertext, CIFS_CPHTXT_SIZE);
 		sec_blob->SessionKey.BufferOffset = cpu_to_le32(tmp - pbuffer);
 		sec_blob->SessionKey.Length = cpu_to_le16(CIFS_CPHTXT_SIZE);
Signature · 1 line
1.6.0.2

A message that is not in the archive (sent off-list or not yet received): 1291828398-27336-1-git-send-email-shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Acked-by
#2 lore raw
Quoted 31 lines · On Wed, 8 Dec 2010 11:13:18 -0600 shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@pub…

From: Shirish Pargaonkar <[email protected]>

Indicate to the server a capability of NTLM2 session security (NTLM2 Key) during ntlmssp protocol exchange in one of the bits of the flags field. If server supports this capability, send NTLM2 key even if signing is not required on the server.
If the server requires signing, the session keys exchanged for NTLMv2 and NTLM2 session security in auth packet of the nlmssp exchange are same.

---
 fs/cifs/sess.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
fs/cifs/sess.c +1 -1
index 7b01d3f..44c2989 100644
@@ -437,7 +437,7 @@ static void build_ntlmssp_negotiate_blob(unsigned char *pbuffer,
 	/* BB is NTLMV2 session security format easier to use here? */
 	flags = NTLMSSP_NEGOTIATE_56 |	NTLMSSP_REQUEST_TARGET |
 		NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE |
-		NTLMSSP_NEGOTIATE_NTLM;
+		NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC;
 	if (ses->server->secMode &
 			(SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) {
 		flags |= NTLMSSP_NEGOTIATE_SIGN;
@@ -544,8 +544,9 @@ static int build_ntlmssp_auth_blob(unsigned char *pbuffer,
 	sec_blob->WorkstationName.MaximumLength = 0;

fs/cifs/sess.c static int build_ntlmssp_auth_blob(unsigned char *pbuffer, · line 552

Quoted 10 lines
fs/cifs/sess.c +3 -2
 	tmp += 2;
 
-	if ((ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_KEY_XCH) &&
-			!calc_seckey(ses)) {
+	if (((ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_KEY_XCH) ||
+		(ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_EXTENDED_SEC))
+			&& !calc_seckey(ses)) {
 		memcpy(tmp, ses->ntlmssp->ciphertext, CIFS_CPHTXT_SIZE);
 		sec_blob->SessionKey.BufferOffset = cpu_to_le32(tmp - pbuffer);
 		sec_blob->SessionKey.Length = cpu_to_le16(CIFS_CPHTXT_SIZE);

Looks reasonable.