From 78eee03e1f32c200b0d8ec969ae205b2a8d6a1da Mon Sep 17 00:00:00 2001
From: Steve French <stevef@stevef95.austin.ibm.com>
Date: Mon, 7 Jul 2003 22:58:48 -0700
Subject: [PATCH] ntlmssp signing

---
 fs/cifs/cifs_debug.c |  6 ++++--
 fs/cifs/connect.c    | 11 +++++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index bf14b0d13ac7..a45b55dfeb0d 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -89,8 +89,8 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
 				ses->serverOS, ses->serverNOS, ses->capabilities);
 		buf += length;
 		if(ses->server)
-			buf += sprintf(buf, "\tLocal Users To Same Server: %d ",
-				atomic_read(&ses->server->socketUseCount));
+			buf += sprintf(buf, "\tLocal Users To Same Server: %d SecMode: 0x%x",
+				atomic_read(&ses->server->socketUseCount),ses->server->secMode);
 	}
 	read_unlock(&GlobalSMBSeslock);
 	sprintf(buf, "\n");
@@ -590,6 +590,8 @@ packet_signing_enabled_write(struct file *file, const char *buffer,
 		sign_CIFS_PDUs = 0;
 	else if (c == '1' || c == 'y' || c == 'Y')
 		sign_CIFS_PDUs = 1;
+	else if (c == '2')
+		sign_CIFS_PDUs = 2;
 
 	return count;
 }
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index bd5feea8f4b7..43c967b3f5fa 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1730,8 +1730,15 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
 				if(SecurityBlob2->NegotiateFlags & NTLMSSP_NEGOTIATE_NTLMV2)
 					*pNTLMv2_flag = TRUE;
 
-/*				if(SecurityBlob2->NegotiateFlags & NTLMSSP_NEGOTIATE_SIGN)
-					always sign */ /* BB FIXME BB */
+				if((SecurityBlob2->NegotiateFlags & 
+					NTLMSSP_NEGOTIATE_ALWAYS_SIGN) 
+					|| (sign_CIFS_PDUs > 1))
+						ses->server->secMode |= 
+							SECMODE_SIGN_REQUIRED;	
+				if ((SecurityBlob2->NegotiateFlags & 
+					NTLMSSP_NEGOTIATE_SIGN) && (sign_CIFS_PDUs))
+						ses->server->secMode |= 
+							SECMODE_SIGN_ENABLED;
 
 				if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) {
 					if ((long) (bcc_ptr) % 2) {
-- 
2.30.9