]> git.pld-linux.org Git - packages/courier-authlib.git/blame - courier-authlib-md5sum-passwords.patch
- fixed files
[packages/courier-authlib.git] / courier-authlib-md5sum-passwords.patch
CommitLineData
a36e4915 1diff -ur courier-authlib-0.56.orig/checkpasswordmd5.c courier-authlib-0.56/checkpasswordmd5.c
2--- courier-authlib-0.56.orig/checkpasswordmd5.c 2004-10-21 02:10:49.000000000 +0200
3+++ courier-authlib-0.56/checkpasswordmd5.c 2005-08-09 12:27:03.000000000 +0200
4@@ -25,7 +25,11 @@
5
6 if (strncasecmp(encrypted_password, "{MD5}", 5) == 0)
7 {
8- return (strcmp(encrypted_password+5, md5_hash_courier(password)));
9+ int a = strcmp(encrypted_password+5, md5_hash_courier(password));
10+ if (a != 0)
11+ return (strcasecmp(encrypted_password+5, md5_hash_hex(password)));
12+ else
13+ return(a);
14 }
15 return (-1);
16 }
17diff -ur courier-authlib-0.56.orig/md5/md5.h courier-authlib-0.56/md5/md5.h
18--- courier-authlib-0.56.orig/md5/md5.h 2002-12-12 05:23:58.000000000 +0100
19+++ courier-authlib-0.56/md5/md5.h 2005-08-09 12:26:27.000000000 +0200
20@@ -56,6 +56,7 @@
a36e4915 21
22 const char *md5_hash_courier(const char *);
e5f66828 23 const char *md5_hash_raw(const char *);
a36e4915 24+const char *md5_hash_hex(const char *);
25
26 #ifdef __cplusplus
27 } ;
28diff -ur courier-authlib-0.56.orig/md5/md5_hash.c courier-authlib-0.56/md5/md5_hash.c
29--- courier-authlib-0.56.orig/md5/md5_hash.c 2002-12-12 05:23:58.000000000 +0100
30+++ courier-authlib-0.56/md5/md5_hash.c 2005-08-09 12:24:05.000000000 +0200
31@@ -11,6 +11,8 @@
32 static const char base64tab[]=
33 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
34
35+static const char hextab[] = "0123456789abcdef";
36+
37 const char *md5_hash_courier(const char *passw)
38 {
39 MD5_DIGEST md5buf;
40@@ -44,3 +46,19 @@
41 hash_buffer[j]=0;
42 return (hash_buffer);
43 }
44+
45+const char *md5_hash_hex(const char *passw) {
46+ MD5_DIGEST md5buf;
47+ static char hash_buffer[2*sizeof(md5buf)+1];
48+ int i, j = 0;
49+
50+ md5_digest(passw, strlen(passw), md5buf);
51+
52+ for (i=0; i<sizeof(md5buf); i++) {
53+ hash_buffer[j++] = hextab[(md5buf[i] & 0xF0) >> 4];
54+ hash_buffer[j++] = hextab[md5buf[i] & 0x0F];
55+ }
56+
57+ hash_buffer[j]=0;
58+ return (hash_buffer);
59+}
This page took 0.090355 seconds and 4 git commands to generate.