[dovecot-cvs] dovecot/src/auth password-scheme.c,1.21,1.22

cras at dovecot.org cras at dovecot.org
Fri Jun 16 13:28:57 EEST 2006


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv2216/auth

Modified Files:
	password-scheme.c 
Log Message:
Added PLAIN-MD4 password scheme. Patch by Andrey Panin.



Index: password-scheme.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/password-scheme.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- password-scheme.c	26 Feb 2006 12:15:34 -0000	1.21
+++ password-scheme.c	16 Jun 2006 10:28:53 -0000	1.22
@@ -344,6 +344,26 @@
 	return binary_to_hex(digest, sizeof(digest));
 }
 
+static bool plain_md4_verify(const char *plaintext, const char *password,
+			     const char *user __attr_unused__)
+{
+	unsigned char digest[16];
+	const char *str;
+
+	md4_get_digest(plaintext, strlen(plaintext), digest);
+	str = binary_to_hex(digest, sizeof(digest));
+	return strcasecmp(str, password) == 0;
+}
+
+static const char *plain_md4_generate(const char *plaintext,
+				      const char *user __attr_unused__)
+{
+	unsigned char digest[16];
+
+	md4_get_digest(plaintext, strlen(plaintext), digest);
+	return binary_to_hex(digest, sizeof(digest));
+}
+
 static bool plain_md5_verify(const char *plaintext, const char *password,
 			     const char *user __attr_unused__)
 {
@@ -452,6 +472,7 @@
 	{ "CLEARTEXT", plain_verify, plain_generate },
 	{ "HMAC-MD5", hmac_md5_verify, hmac_md5_generate },
 	{ "DIGEST-MD5", digest_md5_verify, digest_md5_generate },
+	{ "PLAIN-MD4", plain_md4_verify, plain_md4_generate },
 	{ "PLAIN-MD5", plain_md5_verify, plain_md5_generate },
 	{ "LDAP-MD5", ldap_md5_verify, ldap_md5_generate },
 	{ "LANMAN", lm_verify, lm_generate },



More information about the dovecot-cvs mailing list