aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--driver.c2
-rw-r--r--imap.c14
2 files changed, 11 insertions, 5 deletions
diff --git a/driver.c b/driver.c
index dae0493b..be85b040 100644
--- a/driver.c
+++ b/driver.c
@@ -103,7 +103,7 @@ static jmp_buf restart;
char tag[TAGLEN];
static int tagnum;
-#define GENSYM (sprintf(tag, "a%04d", ++tagnum % TAGMOD), tag)
+#define GENSYM (sprintf(tag, "A%04d", ++tagnum % TAGMOD), tag)
static char *shroud; /* string to shroud in debug output, if non-NULL */
static int mytimeout; /* value of nonreponse timeout */
diff --git a/imap.c b/imap.c
index 85aea358..4292916b 100644
--- a/imap.c
+++ b/imap.c
@@ -55,10 +55,16 @@ int imap_ok(int sock, char *argbuf)
seen = 0;
do {
int ok;
+ char *cp;
if ((ok = gen_recv(sock, buf, sizeof(buf))))
return(ok);
+ /* all tokens in responses are caseblind */
+ for (cp = buf; *cp; cp++)
+ if (islower(*cp))
+ *cp = toupper(*cp);
+
/* interpret untagged status responses */
if (strstr(buf, "* CAPABILITY"))
strncpy(capabilities, buf + 12, sizeof(capabilities));
@@ -81,7 +87,7 @@ int imap_ok(int sock, char *argbuf)
unseen = atoi(cp);
}
if (strstr(buf, "FLAGS"))
- seen = (strstr(buf, "Seen") != (char *)NULL);
+ seen = (strstr(buf, "SEEN") != (char *)NULL);
} while
(tag[0] != '\0' && strncmp(buf, tag, strlen(tag)));
@@ -562,7 +568,7 @@ static int do_gssauth(int sock, char *hostname, char *username)
}
#endif /* GSSAPI */
-static char *canonify_imap_password(char *passwd)
+static char *canonicalize_imap_password(char *passwd)
/* encode an IMAP password as per RFC1730's quoting conventions */
{
char *result;
@@ -594,7 +600,7 @@ int imap_getauth(int sock, struct query *ctl, char *greeting)
if ((ok = gen_transact(sock, "CAPABILITY")) == PS_SUCCESS)
{
/* UW-IMAP server 10.173 notifies in all caps */
- if (strstr(capabilities, "IMAP4rev1") || strstr(capabilities, "IMAP4REV1"))
+ if (strstr(capabilities, "IMAP4REV1"))
{
imap_version = IMAP4rev1;
if (outlevel == O_VERBOSE)
@@ -678,7 +684,7 @@ int imap_getauth(int sock, struct query *ctl, char *greeting)
/* try to get authorized in the ordinary (AUTH=LOGIN) way */
{
- char *newpass = canonify_imap_password(ctl->password);
+ char *newpass = canonicalize_imap_password(ctl->password);
if (!newpass)
return(PS_AUTHFAIL); /* should report error better!!!! */