With the stock qmail-ldap checkpassword program, it is of course possible
to have people authenticate via POP using user@domain.  However, some mail
clients, notably some Macintosh clients, will not accept user@domain as a
valid POP user, or will fail in weird ways.

Therefore, I found it necessary to give them some other way to login.  The
way I came up with is to have them log in with user%domain, and have
checkpassword change the % to an @ sign before building the ldap filter.

Below is a patch to checkpassword.c to do this.  It's a very simple 3-line
patch, but I thought anyone who has run into this problem may be able to
make use of it.

---begin patch---
--- checkpassword.c.orig        2003-02-13 16:35:16.000000000 -0700
+++ checkpassword.c     2003-02-13 17:19:24.000000000 -0700
@@ -135,6 +135,7 @@
        searchinfo      search;
        stralloc    filter = {0};
        int                     ret;
+       int                     i;
        char            *attrs[] = { LDAP_UID, /* the first 6 attrs are
default */
                                                         LDAP_QMAILUID,
                                                         LDAP_QMAILGID,
@@ -144,6 +145,12 @@
                                                         LDAP_HOMEDIR,
                                                         LDAP_PASSWD, 0 };
/* passwd is
extra */

+       /* Replace % with @, for broken clients */
+       /* By: Erik Nielsen <[EMAIL PROTECTED]> */
+       for(i = 0; i < login->len; i++)
+               if(login->s[i] == '%')
+                       login->s[i] = '@';
+
        /* initalize the different info objects */
        if ( rebind ) {
                extra[0].what = 0;      /* under rebind mode no additional
info is needed */
---end patch---


-- 
Erik Nielsen
Software Engineer
EmergeCore
[EMAIL PROTECTED]


Reply via email to