When using courier-imapd and authdaemond.pgsql from the Debian (sid)
packages, one only seems to be able to authenticate using plain passwords
(not md5). I ran into this problem a couple of months ago, but because
PostgreSQL 7.2 allowed for easy use of unencrypted passwords, I changed my
setup to use this less secure form of authentication (this is a
development environment only). Searching for the solution on Google I came
across this thread on pgsql-interfaces:

http://archives.postgresql.org/pgsql-interfaces/2002-08/msg00061.php

Yesterday while upgrading to PostgreSQL 7.3 I noticed that the new default
is to use md5 passwords, which still didn't seem to work. Trying to
compile the packages by hand I got:

/usr/lib/postgresql/lib/libpq.a(md5.o)(.text+0xae4): In function `md5_hash':
: multiple definition of `md5_hash'
../md5/libmd5.a(md5_hash.o)(.text+0x0):/home/jdrowell/tmp/courier-0.40.1/md5/md5_hash.c:15:
first defined here
/usr/bin/ld: Warning: size of symbol `md5_hash' changed from 255 to 73 in
/usr/lib/postgresql/lib/libpq.a(md5.o)
collect2: ld returned 1 exit status
make[1]: *** [authpgsql] Error 1
make[1]: Leaving directory `/home/jdrowell/tmp/courier-0.40.1/authlib'
make: *** [all] Error 2

So both PostgreSQL and Courier have their own md5 functions with the same
names (sounds like zlib in the kernel, doesn't it? ;)). I "fixed" this by
renaming the Courier variant to "md5_hash_courier", as exemplified in the
patch below. Hopefully either project will make appropriate changes to the
function names. Anyway, the fix worked for me, and I'm a happy camper
again :) This is an exim + spamassassin + courier-imapd + squirrelmail +
postgresql setup, now working with md5 passwords on the pgsql backend.

Cheers,
jd

diff -u -r courier-0.40.1/authlib/checkpasswordmd5.c
courier-0.40.1-jd/authlib/c
heckpasswordmd5.c
--- courier-0.40.1/authlib/checkpasswordmd5.c   2000-09-02
21:49:44.000000000 -0
300
+++ courier-0.40.1-jd/authlib/checkpasswordmd5.c        2002-12-06
04:56:18.0000
00000 -0200
@@ -25,7 +25,7 @@

        if (strncasecmp(encrypted_password, "{MD5}", 5) == 0)
        {
-               return (strcmp(encrypted_password+5, md5_hash(password)));
+               return (strcmp(encrypted_password+5,
md5_hash_courier(password))
);
        }
        return (-1);
 }
diff -u -r courier-0.40.1/authlib/cryptpassword.c
courier-0.40.1-jd/authlib/cryp
tpassword.c
--- courier-0.40.1/authlib/cryptpassword.c      2002-06-12
10:55:10.000000000 -0
300
+++ courier-0.40.1-jd/authlib/cryptpassword.c   2002-12-06
04:56:43.000000000 -0
200
@@ -67,7 +67,7 @@
        if (!encryption_hint || strncmp(encryption_hint, "$1$", 3) == 0
            || strncasecmp(encryption_hint, "{MD5}", 5) == 0)
        {
-               hash_func= &md5_hash;
+               hash_func= &md5_hash_courier;
                pfix="{MD5}";
        }
 #endif
diff -u -r courier-0.40.1/md5/md5.h courier-0.40.1-jd/md5/md5.h
--- courier-0.40.1/md5/md5.h    2001-11-01 06:34:07.000000000 -0200
+++ courier-0.40.1-jd/md5/md5.h 2002-12-06 04:54:33.000000000 -0200
@@ -55,7 +55,7 @@
 char *md5_crypt_redhat(const char *, const char *);
 #define        md5_crypt       md5_crypt_redhat

-const char *md5_hash(const char *);
+const char *md5_hash_courier(const char *);

 #ifdef __cplusplus
 } ;
diff -u -r courier-0.40.1/md5/md5_hash.c courier-0.40.1-jd/md5/md5_hash.c
--- courier-0.40.1/md5/md5_hash.c       2000-09-02 21:49:44.000000000 -0300
+++ courier-0.40.1-jd/md5/md5_hash.c    2002-12-06 04:55:11.000000000 -0200
@@ -11,7 +11,7 @@
 static const char base64tab[]=
 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

-const char *md5_hash(const char *passw)
+const char *md5_hash_courier(const char *passw)
 {
 MD5_DIGEST md5buf;
 static char hash_buffer[1+(sizeof(md5buf)+2)/3*4];





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to