]> git.pld-linux.org Git - packages/courier-authlib.git/commitdiff
- this patch adds support for md5sum hashed passwords
authorkosmo <kosmo@pld-linux.org>
Tue, 9 Aug 2005 13:54:49 +0000 (13:54 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    courier-authlib-md5sum-passwords.patch -> 1.1

courier-authlib-md5sum-passwords.patch [new file with mode: 0644]

diff --git a/courier-authlib-md5sum-passwords.patch b/courier-authlib-md5sum-passwords.patch
new file mode 100644 (file)
index 0000000..51ab69d
--- /dev/null
@@ -0,0 +1,59 @@
+diff -ur courier-authlib-0.56.orig/checkpasswordmd5.c courier-authlib-0.56/checkpasswordmd5.c
+--- courier-authlib-0.56.orig/checkpasswordmd5.c       2004-10-21 02:10:49.000000000 +0200
++++ courier-authlib-0.56/checkpasswordmd5.c    2005-08-09 12:27:03.000000000 +0200
+@@ -25,7 +25,11 @@
+       if (strncasecmp(encrypted_password, "{MD5}", 5) == 0)
+       {
+-               return (strcmp(encrypted_password+5, md5_hash_courier(password)));
++              int a = strcmp(encrypted_password+5, md5_hash_courier(password));
++              if (a != 0)
++                  return (strcasecmp(encrypted_password+5, md5_hash_hex(password)));
++              else
++                  return(a);
+       }
+       return (-1);
+ }
+diff -ur courier-authlib-0.56.orig/md5/md5.h courier-authlib-0.56/md5/md5.h
+--- courier-authlib-0.56.orig/md5/md5.h        2002-12-12 05:23:58.000000000 +0100
++++ courier-authlib-0.56/md5/md5.h     2005-08-09 12:26:27.000000000 +0200
+@@ -56,6 +56,7 @@
+ #define       md5_crypt       md5_crypt_redhat
+ const char *md5_hash_courier(const char *);
++const char *md5_hash_hex(const char *);
+ #ifdef        __cplusplus
+ } ;
+diff -ur courier-authlib-0.56.orig/md5/md5_hash.c courier-authlib-0.56/md5/md5_hash.c
+--- courier-authlib-0.56.orig/md5/md5_hash.c   2002-12-12 05:23:58.000000000 +0100
++++ courier-authlib-0.56/md5/md5_hash.c        2005-08-09 12:24:05.000000000 +0200
+@@ -11,6 +11,8 @@
+ static const char base64tab[]=
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
++static const char hextab[] = "0123456789abcdef";
++
+ const char *md5_hash_courier(const char *passw)
+ {
+ MD5_DIGEST md5buf;
+@@ -44,3 +46,19 @@
+       hash_buffer[j]=0;
+       return (hash_buffer);
+ }
++
++const char *md5_hash_hex(const char *passw) {
++    MD5_DIGEST md5buf;
++    static char hash_buffer[2*sizeof(md5buf)+1];
++    int i, j = 0;
++
++    md5_digest(passw, strlen(passw), md5buf);
++
++    for (i=0; i<sizeof(md5buf); i++) {
++      hash_buffer[j++] = hextab[(md5buf[i] & 0xF0) >> 4];
++      hash_buffer[j++] = hextab[md5buf[i] & 0x0F];
++    }
++
++    hash_buffer[j]=0;
++    return (hash_buffer);
++}
This page took 0.057227 seconds and 4 git commands to generate.