report(stderr, _("Lock-busy error on %s@%s\n"),
ctl->remotename,
ctl->server.truename);
- else
+ else if (ok == PS_AUTHFAIL)
{
- if (ok == PS_ERROR)
- ok = PS_AUTHFAIL;
report(stderr, _("Authorization failure on %s@%s\n"),
ctl->remotename,
ctl->server.truename);
ctl->wedged = TRUE;
}
}
+ else
+ report(stderr, _("Unknown login or authentication error on %s@%s\n"),
+ ctl->remotename,
+ ctl->server.truename);
+
goto cleanUp;
}
}
#define IMAP4 0 /* IMAP4 rev 0, RFC1730 */
#define IMAP4rev1 1 /* IMAP4 rev 1, RFC2060 */
+static int imap_phase;
+#define PHASE_GETAUTH 0
+#define PHASE_GETRANGE 1
+#define PHASE_GETSIZES 2
+#define PHASE_FETCH 3
+#define PHASE_LOGOUT 4
+
static int count, seen, recent, unseen, deletions, imap_version, preauth;
static int expunged, expunge_period;
static char capabilities[MSGBUFSIZE+1];
else if (strncmp(cp, "BAD", 3) == 0)
return(PS_ERROR);
else if (strncmp(cp, "NO", 2) == 0)
- return(PS_ERROR);
+ {
+ if (imap_phase == PHASE_GETAUTH)
+ return(PS_AUTHFAIL); /* RFC2060, 6.2.2 */
+ else
+ return(PS_ERROR);
+ }
else
return(PS_PROTOCOL);
}
};
if (rval)
- return PS_AUTHFAIL;
+ return(PS_AUTHFAIL);
to64frombits(buffer, response, strlen(response));
{
int ok = 0;
+ imap_phase = PHASE_GETAUTH;
+
/* probe to see if we're running IMAP4 and can use RFC822.PEEK */
capabilities[0] = '\0';
if ((ok = gen_transact(sock, "CAPABILITY")) == PS_SUCCESS)
{
int ok;
+ imap_phase = PHASE_GETRANGE;
+
/* find out how many messages are waiting */
*bytes = recent = unseen = -1;
{
char buf [MSGBUFSIZE+1];
+ imap_phase = PHASE_GETSIZES;
+
/*
* Some servers (as in, PMDF5.1-9.1 under OpenVMS 6.1)
* won't accept 1:1 as valid set syntax. Some implementors
sizes[num - 1] = size;
}
+ imap_phase = PHASE_FETCH;
+
return(PS_SUCCESS);
}
static int imap_logout(int sock, struct query *ctl)
/* send logout command */
{
+ imap_phase = PHASE_LOGOUT;
+
/* if any un-expunged deletions remain, ship an expunge now */
if (deletions)
internal_expunge(sock);