[dovecot-cvs] dovecot/src/lib-ntlm ntlm-encrypt.c, 1.1, 1.2 ntlm-encrypt.h, 1.1, 1.2 ntlm-types.h, 1.1, 1.2

cras at dovecot.org cras at dovecot.org
Fri Jul 30 04:43:23 EEST 2004


Update of /home/cvs/dovecot/src/lib-ntlm
In directory talvi:/tmp/cvs-serv10552/lib-ntlm

Modified Files:
	ntlm-encrypt.c ntlm-encrypt.h ntlm-types.h 
Log Message:
Added LANMAN password scheme. Patch by Andrey Panin



Index: ntlm-encrypt.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-ntlm/ntlm-encrypt.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ntlm-encrypt.c	28 Jul 2004 15:39:30 -0000	1.1
+++ ntlm-encrypt.c	30 Jul 2004 01:43:21 -0000	1.2
@@ -46,6 +46,26 @@
 }
 
 const unsigned char *
+lm_hash(const char *passwd, unsigned char hash[LM_HASH_SIZE])
+{
+	static const unsigned char lm_magic[8] = "KGS!@#$%";
+	unsigned char buffer[14];
+	unsigned int i;
+
+	strncpy(buffer, passwd, sizeof(buffer));
+
+	for (i = 0; i < sizeof(buffer); i++)
+		buffer[i] = i_toupper(buffer[i]);
+
+	deshash(hash, buffer, lm_magic);
+	deshash(hash + 8, buffer + 7, lm_magic);
+
+	safe_memset(buffer, 0, sizeof(buffer));
+
+	return hash;
+}
+
+const unsigned char *
 ntlm_v1_hash(const char *passwd, unsigned char hash[NTLMSSP_HASH_SIZE])
 {
 	size_t len;

Index: ntlm-encrypt.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-ntlm/ntlm-encrypt.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ntlm-encrypt.h	28 Jul 2004 15:39:30 -0000	1.1
+++ ntlm-encrypt.h	30 Jul 2004 01:43:21 -0000	1.2
@@ -2,6 +2,9 @@
 #define __NTLM_ENCRYPT__
 
 const unsigned char *
+lm_hash(const char *passwd, unsigned char hash[LM_HASH_SIZE]);
+
+const unsigned char *
 ntlm_v1_hash(const char *passwd, unsigned char hash[NTLMSSP_HASH_SIZE]);
 
 void ntlmssp_v1_response(const unsigned char *hash,

Index: ntlm-types.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-ntlm/ntlm-types.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ntlm-types.h	28 Jul 2004 15:39:30 -0000	1.1
+++ ntlm-types.h	30 Jul 2004 01:43:21 -0000	1.2
@@ -22,6 +22,9 @@
 
 #define NTLMSSP_CHALLENGE_SIZE		8
 
+#define LM_HASH_SIZE			16
+#define LM_RESPONSE_SIZE		24
+
 #define NTLMSSP_HASH_SIZE		16
 #define NTLMSSP_RESPONSE_SIZE		24
 



More information about the dovecot-cvs mailing list