]> git.pld-linux.org Git - packages/courier-authlib.git/blob - courier-authlib-md5sum-passwords.patch
- updated to 0.68.0
[packages/courier-authlib.git] / courier-authlib-md5sum-passwords.patch
1 diff -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  }
17 --- courier-authlib-0.68.0.orig/libs/md5/md5.h  2002-12-12 05:23:58.000000000 +0100
18 +++ courier-authlib-0.68.0/md5/libs/md5.h       2005-08-09 12:26:27.000000000 +0200
19 @@ -56,6 +56,7 @@
20  
21  const char *md5_hash_courier(const char *);
22  const char *md5_hash_raw(const char *);
23 +const char *md5_hash_hex(const char *);
24  
25  #ifdef __cplusplus
26  } ;
27 --- courier-authlib-0.68.0.orig/libs/md5/md5_hash.c     2002-12-12 05:23:58.000000000 +0100
28 +++ courier-authlib-0.68.0/libs/md5/md5_hash.c  2005-08-09 12:24:05.000000000 +0200
29 @@ -11,6 +11,8 @@
30  static const char base64tab[]=
31  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
32  
33 +static const char hextab[] = "0123456789abcdef";
34 +
35  const char *md5_hash_courier(const char *passw)
36  {
37  MD5_DIGEST md5buf;
38 @@ -44,3 +46,19 @@
39         hash_buffer[j]=0;
40         return (hash_buffer);
41  }
42 +
43 +const char *md5_hash_hex(const char *passw) {
44 +    MD5_DIGEST md5buf;
45 +    static char hash_buffer[2*sizeof(md5buf)+1];
46 +    int i, j = 0;
47 +
48 +    md5_digest(passw, strlen(passw), md5buf);
49 +
50 +    for (i=0; i<sizeof(md5buf); i++) {
51 +       hash_buffer[j++] = hextab[(md5buf[i] & 0xF0) >> 4];
52 +       hash_buffer[j++] = hextab[md5buf[i] & 0x0F];
53 +    }
54 +
55 +    hash_buffer[j]=0;
56 +    return (hash_buffer);
57 +}
This page took 0.052013 seconds and 3 git commands to generate.