diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1998-03-13 03:50:54 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1998-03-13 03:50:54 +0000 |
commit | 996083bee5b585d53f8232c049ecc23a2c01cac5 (patch) | |
tree | debe1511546cbe20157afc2cdba69afb0233706d | |
parent | ceaef31ff6860e0904e9d738e4bea2860980e439 (diff) | |
download | fetchmail-996083bee5b585d53f8232c049ecc23a2c01cac5.tar.gz fetchmail-996083bee5b585d53f8232c049ecc23a2c01cac5.tar.bz2 fetchmail-996083bee5b585d53f8232c049ecc23a2c01cac5.zip |
True caseblinding.
svn path=/trunk/; revision=1697
-rw-r--r-- | driver.c | 2 | ||||
-rw-r--r-- | imap.c | 14 |
2 files changed, 11 insertions, 5 deletions
@@ -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 */ @@ -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!!!! */ |