4 messages in net.sourceforge.lists.courier-sqwebmailRe: [sqwebmail] sqwebmail with vpopma...
FromSent OnAttachments
Camilo RostokerNov 10, 2004 12:29 pm 
mattiNov 10, 2004 10:53 pm 
Brian CandlerNov 11, 2004 12:42 am 
Brian CandlerNov 12, 2004 4:20 am.Other
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [sqwebmail] sqwebmail with vpopmail using cdb?Actions...
From:Brian Candler (B.Ca@pobox.com)
Date:Nov 12, 2004 4:20:13 am
List:net.sourceforge.lists.courier-sqwebmail
Attachments:
courier-authlib-vchkpw - 5k

I have vpopmail installed and working properly, and it uses the default authentication scheme (cdb). Now, what do I have to do to get sqwebmail to work with this setup? Is it even possible

I have it working on my machine with vpopmail-5.4.7, courier-authlib-0.50.20041103 plus the attached patch, and sqwebmail-4.0.7.20041103

If you want to run with an older version, try just removing the following line from authlib/preauthvchkpw.c and recompile:

auth.sysusername = userid;

That may (untested) be sufficient to fix the problem for you.

Regards,

Brian.

--- courier-authlib-0.50.20041103.r2/Makefile.am Thu Nov 4 02:54:50 2004 +++ courier-authlib-0.50.20041103/Makefile.am Fri Nov 12 10:33:14 2004 @@ -14,7 +14,7 @@ modules=@LIBAUTHUSERDB@ \ @LIBAUTHPAM@ @LIBAUTHPWD@ @LIBAUTHSHADOW@ \ @LIBAUTHPGSQL@ @LIBAUTHLDAP@ @LIBAUTHMYSQL@ \ - @LIBAUTHCUSTOM@ + @LIBAUTHCUSTOM@ @LIBAUTHVCHKPW@

pkglibexecdir=$(libexecdir)/courier-authlib pkglibexec_SCRIPTS=authsystem.passwd --- courier-authlib-0.50.20041103.r2/Makefile.in Thu Nov 4 02:55:21 2004 +++ courier-authlib-0.50.20041103/Makefile.in Fri Nov 12 10:37:10 2004 @@ -429,7 +429,7 @@ modules = @LIBAUTHUSERDB@ \ @LIBAUTHPAM@ @LIBAUTHPWD@ @LIBAUTHSHADOW@ \ @LIBAUTHPGSQL@ @LIBAUTHLDAP@ @LIBAUTHMYSQL@ \ - @LIBAUTHCUSTOM@ + @LIBAUTHCUSTOM@ @LIBAUTHVCHKPW@

pkglibexecdir = $(libexecdir)/courier-authlib pkglibexec_SCRIPTS = authsystem.passwd --- courier-authlib-0.50.20041103.r2/authvchkpw.c Thu Oct 21 01:10:49 2004 +++ courier-authlib-0.50.20041103/authvchkpw.c Fri Nov 12 11:37:29 2004 @@ -31,8 +31,7 @@

struct callback_info { const char *pass; - int issession; - void (*callback_func)(struct authinfo *, void *); + int (*callback_func)(struct authinfo *, void *); void *callback_arg; };

@@ -56,8 +55,7 @@ }

int auth_vchkpw(const char *service, const char *authtype, char *authdata, - int issession, - void (*callback_func)(struct authinfo *, void *), void *callback_arg) + int (*callback_func)(struct authinfo *, void *), void *callback_arg) { char *user, *pass; struct callback_info ci; @@ -75,7 +73,6 @@ }

ci.pass=pass; - ci.issession=issession; ci.callback_func=callback_func; ci.callback_arg=callback_arg;

@@ -141,6 +138,7 @@ * parts. (If a domain was not supplied, then set the domain to be * the default domain) */ + /* WARNING: parse_email lowercases the username in place - not const!!
*/ if ( parse_email(username, User, Domain, 256) != 0) { /* Failed to successfully extract user and domain. * So now exit with a permanent failure code @@ -173,7 +171,7 @@ }

/* save the new password into the auth backend */ - if ( vpasswd(User, Domain, npass, 0) != 0 ) { + if ( vpasswd(User, Domain, (char *)npass, 0) != 0 ) { /* password set failed */ return (-1); }; --- courier-authlib-0.50.20041103.r2/preauthvchkpw.c Thu Oct 21 01:10:49 2004 +++ courier-authlib-0.50.20041103/preauthvchkpw.c Fri Nov 12 12:08:21 2004 @@ -55,6 +55,7 @@ struct authinfo auth; static char User[256]; static char Domain[256]; +static char options[80];

/* Make sure the auth struct is empty */ memset(&auth, 0, sizeof(auth)); @@ -92,27 +93,6 @@ return (-1); }

- /* Look at what type of connection we are trying to auth. - * And then see if the user is permitted to make this type - * of connection - */ - if ( strcmp("webmail", service) == 0 ) { - if (vpw->pw_flags & NO_WEBMAIL) { - dprintf("vchkpw: webmail disabled for this account"); - return(-1); - } - } else if ( strcmp("pop3", service) == 0 ) { - if ( vpw->pw_flags & NO_POP ) { - dprintf("vchkpw: pop3 disabled for this account"); - return(-1); - } - } else if ( strcmp("imap", service) == 0 ) { - if ( vpw->pw_flags & NO_IMAP ) { - dprintf("vchkpw: imap disabled for this account"); - return(-1); - } - } - /* Check to see if the user has been allocated a dir yet. * Some of the vpopmail backends (eg mysql) allow users to * be manually inserted into the auth backend but without @@ -140,6 +120,12 @@ } }

+ snprintf(options, sizeof(options), + "disablewebmail=%d,disablepop3=%d,disableimap=%d", + vpw->pw_flags & NO_WEBMAIL ? 1 : 0, + vpw->pw_flags & NO_POP ? 1 : 0, + vpw->pw_flags & NO_IMAP ? 1 : 0); + #ifdef HAVE_VSET_LASTAUTH /* if we are keeping track of their last auth time, * then store this value now. Note that this isnt @@ -158,13 +144,14 @@ /* save the user's passwd fields into the appropriate * courier structure */ - auth.sysusername = userid; + /*auth.sysusername = userid;*/ auth.sysuserid = &uid; auth.sysgroupid = gid; auth.homedir = vpw->pw_dir; auth.address = userid; auth.fullname = vpw->pw_gecos; auth.passwd = vpw->pw_passwd; + auth.options = options; courier_authdebug_authinfo("DEBUG: authvchkpw: ", &auth, 0, vpw->pw_passwd);

return ((*callback)(&auth, arg));