]> Pileus Git - ~andy/fetchmail/blobdiff - imap.c
LinuxWorld hacks.
[~andy/fetchmail] / imap.c
diff --git a/imap.c b/imap.c
index 0481587a7401affe5fd08fc5216b49cc117c8273..3e39b6fb050b7490254c28488ad06a513d644f59 100644 (file)
--- a/imap.c
+++ b/imap.c
@@ -144,7 +144,12 @@ int imap_ok(int sock, char *argbuf)
        else if (strncmp(cp, "BAD", 3) == 0)
            return(PS_ERROR);
        else if (strncmp(cp, "NO", 2) == 0)
-           return(PS_ERROR);
+       {
+           if (stage == STAGE_GETAUTH) 
+               return(PS_AUTHFAIL);    /* RFC2060, 6.2.2 */
+           else
+               return(PS_ERROR);
+       }
        else
            return(PS_PROTOCOL);
     }
@@ -196,7 +201,7 @@ static int do_otp(int sock, struct query *ctl)
     };
 
     if (rval)
-       return PS_AUTHFAIL;
+       return(PS_AUTHFAIL);
 
     to64frombits(buffer, response, strlen(response));
 
@@ -889,7 +894,11 @@ int imap_getauth(int sock, struct query *ctl, char *greeting)
     else
        expunge_period = 1;
 
-    if (preauth)
+    /* 
+     * If either (a) we saw a PREAUTH token in the capability response, or
+     * (b) the user specified ssh preauthentication, then we're done.
+     */
+    if (preauth || ctl->server.preauthenticate == A_SSH)
        return(PS_SUCCESS);
 
 #if OPIE_ENABLE