Here is a correct patch that allows for use of the  "%" (percent),
or ":" (colon) chars as separators for the [EMAIL PROTECTED] problem
for Netscape Messenger clients in a virtual domain(s) environment.

--- authmysql.c Wed Jun 20 21:44:30 2001
+++ authmysql.c-new     Fri Jan 18 09:34:32 2002
@@ -25,15 +25,25 @@
        int issession,
        void (*callback_func)(struct authinfo *, void *), void *callback_arg)
 {
-char *user, *pass;
+char *user, *pass, *charloc;
 struct authmysqluserinfo *authinfo;
 
+const char usertmp[]=":%";
+
+       /* extract user name, e.g.,  [EMAIL PROTECTED] 
+        */
        if ((user=strtok(authdata, "\n")) == 0 ||
                (pass=strtok(0, "\n")) == 0)
        {
                errno=EPERM;
                return (0);
        }
+       /* munge (possibly) substituted chars from user name
+        *  because Netscape 4.xx cannot send an '@' sign when
+        *  requesting authentication
+        */
+
+       if( (charloc= strpbrk(user, usertmp))) *charloc= '@'; 
 
        authinfo=auth_mysql_getuserinfo(user);


I have MySQL passwd table entries that contain entries for:

[EMAIL PROTECTED],   [EMAIL PROTECTED], [EMAIL PROTECTED]  and
localuser (with no @defaultdomain) all work properly.

The Netscape Messenger clients enter their e-mail account names with
either a ":" (colon) or "%" (percent) in place of a "@" (at sign).
They still list their real e-mail address in the proper location
so that folks can replay to them, etc.

As delivered, authmysqllib.c would discover the missing "@" and assume
that it was a username for the 'DEFAULT_DOMAIN" (see authmysqlrc). This
behavior is correct for the case where there is just a username, and 
no @domain...so authmysqllib.c's append_domain function tries to
append the domain name. This would result in something like:
        user:[EMAIL PROTECTED]


The patch (above) simply checks for the existence of either alternate
separator BEFORE any attempt to look it up in the MySQL databse and 
then substitutes an '@' for the ":" or "%" that could be used by
Netscape 4.xx clients.

It works equally well for POP3 and IMAP (as you would expect). 
I have *not* even looked at the authpgsqllib.c instance of this; but 
the idea is the same...

My aplologies to the list for posting a lame patch previously.


Randy Lewis

_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to