diff -ru courier-authlib-0.52/authvchkpw.c courier-authlib-0.52-apop/authvchkpw.c --- courier-authlib-0.52/authvchkpw.c 2004-11-14 11:58:16.000000000 +0900 +++ courier-authlib-0.52-apop/authvchkpw.c 2005-01-04 20:01:49.000000000 +0900 @@ -100,7 +100,7 @@ */ #ifdef HAVE_OPEN_SMTP_RELAY - if ( (strcmp("pop3", service)==0) || (strcmp("imap", service)==0) ) { + if ( (strcmp("pop3", service)==0) || (strcmp("imap", service)==0) || (strcmp("apop", service)==0)) { /* Michael Bowe 13th August 2003 * * There is a problem here because open_smtp_relay needs diff -ru courier-authlib-0.52/checkpassword.c courier-authlib-0.52-apop/checkpassword.c --- courier-authlib-0.52/checkpassword.c 2004-10-21 09:10:49.000000000 +0900 +++ courier-authlib-0.52-apop/checkpassword.c 2005-01-04 20:01:49.000000000 +0900 @@ -37,6 +37,7 @@ #if HAVE_MD5LIB if (strncmp(encrypted_password, "$1$", 3) == 0 || strncasecmp(encrypted_password, "{MD5}", 5) == 0 + || strncasecmp(encrypted_password, "{APOP}", 6) == 0 ) return (authcheckpasswordmd5(password, encrypted_password)); #endif diff -ru courier-authlib-0.52/checkpasswordmd5.c courier-authlib-0.52-apop/checkpasswordmd5.c --- courier-authlib-0.52/checkpasswordmd5.c 2004-10-21 09:10:49.000000000 +0900 +++ courier-authlib-0.52-apop/checkpasswordmd5.c 2005-01-04 20:05:48.000000000 +0900 @@ -3,6 +3,8 @@ ** distribution information. */ +#include +#include #if HAVE_CONFIG_H #include "courier_auth_config.h" #endif @@ -27,5 +29,33 @@ { return (strcmp(encrypted_password+5, md5_hash_courier(password))); } + + if (strncasecmp(encrypted_password, "{APOP}", 6) == 0) + { + char *opass, *cpass, *okpass, *p, okmesg[BUFSIZ]; + int j; + MD5_DIGEST digest; + if((opass=malloc(strlen(password)+1)) == 0) + { + perror("malloc"); + exit(1); + } + strcpy(opass, password); + cpass=strtok(opass, " "); + p=strtok(0, "\t\r"); + if((okpass = malloc(strlen(p)+strlen(encrypted_password)+3)) == 0) + { + perror("malloc"); + exit(1); + } + strcat(strcpy(okpass, p), encrypted_password+6); + md5_digest(okpass, strlen(okpass), digest); + for(j=0; j