Howdy list,

This question is for those of you familiar with the Sqwebmail
and Courier-IMAP code:

I've been looking at the sqwebmail and vpopmail code.

sqwebmail uses the EXACT same authvchkpw module that courier-imap
uses. I've checked it with 'diff'. It's identical.

If I execute the following code in the authlib directory of either
program, I get the following SH output:

----------------------------------------------------
# TCPLOCALIP=206.30.62.12
# export TCPLOCALIP
# echo $TCPLOCALIP
206.30.62.12
# ./authtest jesse
Authenticated: module authvchkpw
Home directory: /usr/local/vpopmail/domains/ocoeeregion.com/jesse
UID/GID: 89/89
AUTHADDR=jesse
AUTHFULLNAME=Jesse D. Guardiani
-----------------------------------------------------

This is the CORRECT output. Here it is without the setting
TCPLOCALIP:

----------------------------------------------------
# unset TCPLOCALIP
# ./authtest jesse
Authenticated: module authvchkpw
Home directory: /usr/local/vpopmail/domains/onerateamerica.com/jesse
UID/GID: 89/89
AUTHADDR=jesse
AUTHFULLNAME=jesse
----------------------------------------------------

So here's the question:

If the authvchkpw code is the same for sqwebmail and courier-imap,
and both authtest programs are receptive to setting TCPLOCALIP,
*WHY* can I not simply set the environment variable TCPLOCALIP
before the login() function in sqwebmail's main() to implement
IP-alias domain in sqwebmail???

I've implemented the following:

-----------------------------------------------------
--- sqwebmail.c Mon Jan 27 14:00:17 2003
+++ sqwebmail.c.old     Mon Jan 27 15:47:34 2003
@@ -2401,27 +2395,7 @@
                const char *u2=cgi("logindomain");
                char    *ubuf=malloc(strlen(u)+strlen(u2)+2);
                int can_changepwd;
-
-                       /* The following code attempts to set the TCPLOCALIP 
environment
-                        * variable so that vpopmail's IP-based domains have the 
oportunity
-                        * to auth properly. - JDG 01/27/03 */
-                       char *server_addr=getenv("SERVER_ADDR");
-                       int r_code = setenv("TCPLOCALIP", server_addr, 1);
-
-                       if (r_code != 0)
-                       {
-                               syslog(LOG_INFO | LOG_DAEMON, "sqwebmail: setenv 
\"TCPLOCALIP\" failed");
-                               fake_exit(1);
-                       }
-                       else
-                       {
-                               syslog(LOG_INFO | LOG_DAEMON, "sqwebmail: setenv 
\"TCPLOCALIP\" worked");
-                               syslog(LOG_INFO | LOG_DAEMON, "sqwebmail: 
server_addr=%s", server_addr);
-                               syslog(LOG_INFO | LOG_DAEMON, "sqwebmail: 
logindomain=%s", u2);
-                               syslog(LOG_INFO | LOG_DAEMON, "sqwebmail: 
username=%s", u);
-                       }

-
                        strcpy(ubuf, u);
                        if (*u2)
                                strcat(strcat(ubuf, "@"), u2);
-----------------------------------------------------

The above patch sets TCPLOCALIP in the main() function,
just before login() is called to retrieve the mailboxid.

I've checked the setting of TCPLOCALIP all the way to the
auth_vchkpw_pre() function in authvchkpw.c.

TCPLOCALIP is SET. But IP-alias domains still don't work.

I DO have working courier-IMAP/vpopmail IP-alias domains.
I can login with IMAP at 'ocoeeregion.com' with user 'jesse',
and everything works fine. User 'jesse' is authenticated as
'[EMAIL PROTECTED]' without my specifying the domain part
in the user field.

So... does sqwebmail call it's auth modules differently than
courier-IMAP? Or am I missing something here....

Thanks,

-- 
Jesse Guardiani, Systems Administrator
WingNET Internet Services,
P.O. Box 2605 // Cleveland, TN 37320-2605
423-559-LINK (v)  423-559-5145 (f)
http://www.wingnet.net

We are actively looking for companies that do a lot of long
distance faxing and want to cut their long distance bill by
up to 50%.  Contact [EMAIL PROTECTED] for more info.



Reply via email to