I am sending a patch to make Courier accept alternative ATs in email addresses during login (besides @). It is heavily based in a previous patch by Josh Heizman.
Basically I enclosed the extra code in #ifdef #endif directives so people that don't need this option will have exactly the same code as before.
I believe this patch should be merged in the main Courier code. What do you think about it Mr. Sam?
Anyway, this patch isn't complete as it doesn't include a --with-alternative-at or similar in the configure script. Could you do it Mr. Sam?
In case somebody want to try it, include a
#define ALTERNATIVE_AT "characters_to_be_accepted"
in 'auth.h'.
I've only tested authuserdb and authmysql but as the code is basically the same, I decided to patch authldap.c and authpgsql.c also.
Rodrigo Severo
-- ---------------------------------------------------- Rodrigo Severo Fábrica de Idéias Fone: +55(61)321 1357 Fax: +55(61)223 1712 SBS - Quadra 2 - Ed. Empire Center - Sala 1301 Brasília/DF - Brasil CEP: 70.070-904 ----------------------------------------------------
*** courier.original/courier-0.42.2/authlib/authmysql.c 2003-05-01 18:54:24.000000000 -0300 --- courier-0.42.2/authlib/authmysql.c 2003-06-16 11:14:21.000000000 -0300 *************** *** 26,31 **** --- 26,34 ---- void (*callback_func)(struct authinfo *, void *), void *callback_arg) { char *user, *pass; + #ifdef ALTERNATIVE_AT + const char *locchar; + #endif struct authmysqluserinfo *authinfo; if ((user=strtok(authdata, "\n")) == 0 || *************** *** 35,40 **** --- 38,47 ---- return (0); } + #ifdef ALTERNATIVE_AT + if (locchar=strpbrk(user, ALTERNATIVE_AT)) *locchar='@'; + #endif + authinfo=auth_mysql_getuserinfo(user, service); if (!callback_func) *** courier.original/courier-0.42.2/authlib/authpgsql.c 2003-05-01 18:54:24.000000000 -0300 --- courier-0.42.2/authlib/authpgsql.c 2003-06-16 11:14:41.000000000 -0300 *************** *** 26,31 **** --- 26,34 ---- void (*callback_func)(struct authinfo *, void *), void *callback_arg) { char *user, *pass; + #ifdef ALTERNATIVE_AT + const char *locchar; + #endif struct authpgsqluserinfo *authinfo; if ((user=strtok(authdata, "\n")) == 0 || *************** *** 35,40 **** --- 38,47 ---- return (0); } + #ifdef ALTERNATIVE_AT + if (locchar=strpbrk(user, ALTERNATIVE_AT)) *locchar='@'; + #endif + authinfo=auth_pgsql_getuserinfo(user, service); if (!callback_func) *** courier.original/courier-0.42.2/authlib/authldap.c 2003-05-01 18:54:24.000000000 -0300 --- courier-0.42.2/authlib/authldap.c 2003-06-16 11:15:00.000000000 -0300 *************** *** 96,101 **** --- 96,104 ---- void (*callback_func)(struct authinfo *, void *), void *callback_arg) { const char *user, *pass; + #ifdef ALTERNATIVE_AT + const char *locchar; + #endif struct callback_info ci; int rc; *************** *** 106,111 **** --- 109,118 ---- return (0); } + #ifdef ALTERNATIVE_AT + if (locchar=strpbrk(user, ALTERNATIVE_AT)) *locchar='@'; + #endif + ci.issession=issession; ci.callback_func=callback_func; ci.callback_arg=callback_arg; *** courier.original/courier-0.42.2/authlib/authuserdb.c 2002-08-19 12:30:23.000000000 -0300 --- courier-0.42.2/authlib/authuserdb.c 2003-06-16 11:11:34.000000000 -0300 *************** *** 104,109 **** --- 104,112 ---- void (*callback_func)(struct authinfo *, void *), void *callback_arg) { const char *user, *pass; + #ifdef ALTERNATIVE_AT + const char *locchar; + #endif int rc; struct callback_info ci; *************** *** 115,120 **** --- 118,127 ---- return (0); } + #ifdef ALTERNATIVE_AT + if (locchar=strpbrk(user, ALTERNATIVE_AT)) *locchar='@'; + #endif + ci.pass=pass; ci.callback_func=callback_func; ci.callback_arg=callback_arg;