From 265027a7c122ab9992ca9e6c9a42dd9b93f4944b Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 26 Oct 1999 18:39:04 +0000 Subject: [PATCH] Backed oup username quoting. svn path=/trunk/; revision=2641 --- NEWS | 2 ++ imap.c | 16 +++------------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index 7c647c11..8882bff2 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ * Grant Edwards's patch to correct NTLM behavior. * James Brister's fix for IP-address hostnames. * Updated config.guess and config.sub. +* Backed out the 5.1.0 change to quote usernames with embedded spaces. + It actually breaks things. fetchmail-5.1.2 (Thu Oct 7 09:46:07 EDT 1999), 17906 lines: * Joe Loughry sent a patch to handle multihomed machines. diff --git a/imap.c b/imap.c index 1c7d1fe8..19defbc9 100644 --- a/imap.c +++ b/imap.c @@ -749,7 +749,6 @@ static int do_cram_md5 (int sock, struct query *ctl) { int result; int len; - int quot; unsigned char buf1[1024]; unsigned char msg_id[768]; unsigned char response[16]; @@ -787,28 +786,19 @@ static int do_cram_md5 (int sock, struct query *ctl) * computed by applying the keyed MD5 algorithm from [KEYED-MD5] where * the key is a shared secret and the digested text is the timestamp * (including angle-brackets). - * - * If the usename has a space in it, it's surrounded by string quotes - * before being shipped. This is not in conformance with the CRAM-MD5 - * RFCs (which don't describe any kind of quoting and imply that the - * username must be a single token), but at least one server accepts - * it anyway (the greeting line says "InterChange IMAP4 Server v3.51.06"). - * If this doesn't work, sending the unquoted name wouldn't have worked - * either, so we lost nothing. */ hmac_md5 (ctl->password, strlen (ctl->password), msg_id, strlen (msg_id), response, sizeof (response)); - quot = (int) strpbrk (ctl->remotename, " "); #ifdef HAVE_SNPRINTF snprintf (reply, sizeof (reply), #else sprintf(reply, #endif - "%s%s%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", - quot ? "\"" : "", ctl->remotename, quot ? "\"" : "", + "%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + ctl->remotename, response[0], response[1], response[2], response[3], response[4], response[5], response[6], response[7], response[8], response[9], response[10], response[11], @@ -1268,8 +1258,8 @@ static int imap_trail(int sock, struct query *ctl, int number) : "STORE %d +FLAGS (\\Seen)", number))) return(ok); - } #endif /* __UNUSED__ */ + } return(PS_SUCCESS); } -- 2.43.2