On Mon, Sep 15, 2003 at 04:26:03PM -0300, Rodrigo Pinheiro wrote:
> Hi Claudio and List..
> 
> My qmail-ldap is 20030901, courier-imap version is 1.7.3
> 
> #!/bin/sh
> . /etc/courier/imapd
> LOGLEVEL=255
> export LOGLEVEL
> exec  /usr/bin/tcpserver -v -R -l 0 -H 0  143  /usr/lib/courier/courier/imaplogin  
> /var/qmail/bin/auth_imap /usr/bin/imapd Maildir  2>&1
> 
> 

There is a known bug in the 20030901 auth_imap which was fixed in the
a-release 20030901a. Anyway I attached the needed patch for 20030901.
 
-- 
:wq Claudio
Index: auth_imap.c
===================================================================
RCS file: /home/cvs-qmail-ldap/CVS/qmail-ldap/auth_imap.c,v
retrieving revision 1.14
retrieving revision 1.18
diff -u -r1.14 -r1.18
--- auth_imap.c 19 Aug 2003 15:13:55 -0000      1.14
+++ auth_imap.c 3 Sep 2003 22:32:20 -0000       1.18
@@ -84,12 +84,12 @@
        i = 0;
        s = auth_up; /* ignore service field */
        while (auth_up[i] && auth_up[i] != '\n' ) i++;
-       if (i == auth_uplen)
+       if (i >= auth_uplen)
                auth_error(NEEDED);
        auth_up[i++] = '\0';
        t = auth_up + i; /* type has to be "login" else fail ... */
        while (auth_up[i] && auth_up[i] != '\n' ) i++;
-       if (i == auth_uplen)
+       if (i >= auth_uplen)
                auth_error(NEEDED);
        auth_up[i++] = '\0';
        if (str_diff("login", t)) {
@@ -102,15 +102,15 @@
        }
        l = auth_up + i; /* next login */
        while (auth_up[i] && auth_up[i] != '\n' ) i++;
-       if (i == auth_uplen)
+       if (i >= auth_uplen)
                auth_error(NEEDED);
        auth_up[i++] = '\0';
        p = auth_up + i; /* and the password */
        while (auth_up[i] && auth_up[i] != '\n' ) i++;
-       if (i == auth_uplen)
+       if (i >= auth_uplen)
                auth_error(NEEDED);
        auth_up[i++] = '\0';
-       if (i != auth_uplen) /* paranoia */
+       if (i > auth_uplen) /* paranoia */
                auth_error(NEEDED);
 
        /* copy the login and password into the coresponding structures */
@@ -134,8 +134,8 @@
        t = auth_up;
        
        log(2, "warning: auth_fail: user %s failed\n", login);
-       if (reason == NOSUCH ) {
-               log(4, "warning: auth_fail: user %s not found\n", login);
+       if (reason == NOSUCH || reason == AUTH_TYPE) {
+               log(4, "warning: auth_fail: %s\n", qldap_err_str(reason));
                if (!env_unset("AUTHENTICATED"))
                        auth_error(ERRNO);
                for (i=0; i<auth_uplen; i++) if (!auth_up[i]) auth_up[i] = '\n';
@@ -168,7 +168,7 @@
                close(pi[1]);
                _exit(0);
        }
-       auth_error(PANIC); /* complete failure */
+       auth_error(reason); /* complete failure */
 }
 
 void
@@ -199,7 +199,7 @@
        byte_zero(auth_up, sizeof(auth_up));
        
        log(2, "warning: auth_error: authorization failed (%s)\n",
-                  qldap_err_str(errnum) );
+                  qldap_err_str(errnum));
        if (!(env = env_get("AUTHARGC")))
                _exit(111);
        scan_ulong(env, &numarg);
@@ -219,7 +219,7 @@
        if (!(env = env_get("AUTHUSER")))
                _exit(100);
 #endif
-       execv(env, argvs);
+       execv(*argvs, argvs);
        _exit(111);
        
 }

Reply via email to