[Dovecot] dovecot not working with some vpopmail passwords

radus at smartpost.ro radus at smartpost.ro
Thu Sep 30 22:07:42 EEST 2004


Hello.

I tried installing dovecot on a server that relies on vpopmail
authentication using $1$ MD5 algorithm and it didn't work.
Please fix this for the next release.
Attached is a patch, please be carefull with the line wrapping.

Radu

--- passdb-vpopmail.c.old       Thu Feb 20 00:46:51 2003
+++ passdb-vpopmail.c   Thu Sep 30 18:58:56 2004
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2003 Timo Sirainen */
+/* Copyright (C) 2002-2003 cTimo Sirainen */

 /* Thanks to Courier-IMAP for showing how the vpopmail API should be used */

@@ -20,6 +20,7 @@
 {
        char vpop_user[VPOPMAIL_LIMIT], vpop_domain[VPOPMAIL_LIMIT];
        struct vqpasswd *vpw;
+       char *password_crypt;
        int result;

        vpw = vpopmail_lookup_vqp(request->user,
@@ -44,7 +45,12 @@
        }

        /* verify password */
-       result = strcmp(mycrypt(password, vpw->pw_passwd), vpw->pw_passwd)
== 0;
+
+        if (strncmp(vpw->pw_passwd, "$1$", 3) == 0)
+               password_crypt = md5_crypt(password, vpw->pw_passwd);
+       else password_crypt = crypt(password, vpw->pw_passwd);
+
+       result = strcmp(password_crypt, vpw->pw_passwd) == 0;
        safe_memset(vpw->pw_passwd, 0, strlen(vpw->pw_passwd));

        if (!result) {




More information about the dovecot mailing list