svn commit: samba r3294 - in branches/SAMBA_3_0/source/libsmb: .

jra at samba.org jra at samba.org
Wed Oct 27 17:40:34 GMT 2004


Author: jra
Date: 2004-10-27 17:40:28 +0000 (Wed, 27 Oct 2004)
New Revision: 3294

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_3_0/source/libsmb&rev=3294&nolog=1

Log:
Fix for SMB signing with 56-bit DES session keys. From Nalin Dahyabhai <nalin at redhat.com>.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/libsmb/smb_signing.c


Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/smb_signing.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/smb_signing.c	2004-10-27 17:40:01 UTC (rev 3293)
+++ branches/SAMBA_3_0/source/libsmb/smb_signing.c	2004-10-27 17:40:28 UTC (rev 3294)
@@ -255,6 +255,7 @@
 	const size_t offset_end_of_sig = (smb_ss_field + 8);
 	unsigned char sequence_buf[8];
 	struct MD5Context md5_ctx;
+	unsigned char key_buf[16];
 
 	/*
 	 * Firstly put the sequence number into the first 4 bytes.
@@ -276,8 +277,14 @@
 	MD5Init(&md5_ctx);
 
 	/* intialise with the key */
-	MD5Update(&md5_ctx, data->mac_key.data, 
-		  data->mac_key.length); 
+	/* NB. When making and verifying SMB signatures, Windows apparently
+		zero-pads the key to 128 bits if it isn't long enough.
+		From Nalin Dahyabhai <nalin at redhat.com> */
+	MD5Update(&md5_ctx, data->mac_key.data, data->mac_key.length); 
+	if (data->mac_key.length < sizeof(key_buf)) {
+		memset(key_buf, 0, sizeof(key_buf));
+		MD5Update(&md5_ctx, key_buf, sizeof(key_buf) - data->mac_key.length);
+	}
 
 	/* copy in the first bit of the SMB header */
 	MD5Update(&md5_ctx, buf + 4, smb_ss_field - 4);



More information about the samba-cvs mailing list