aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1998-03-13 03:50:54 +0000
committerEric S. Raymond <esr@thyrsus.com>1998-03-13 03:50:54 +0000
commit996083bee5b585d53f8232c049ecc23a2c01cac5 (patch)
treedebe1511546cbe20157afc2cdba69afb0233706d
parentceaef31ff6860e0904e9d738e4bea2860980e439 (diff)
downloadfetchmail-996083bee5b585d53f8232c049ecc23a2c01cac5.tar.gz
fetchmail-996083bee5b585d53f8232c049ecc23a2c01cac5.tar.bz2
fetchmail-996083bee5b585d53f8232c049ecc23a2c01cac5.zip
True caseblinding.
svn path=/trunk/; revision=1697
-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!!!! */