From 45f5585046d8411c275c5116fff1430e7c458e2f Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 3 Mar 1998 21:54:13 +0000 Subject: Implement RFC1730 quoting. svn path=/trunk/; revision=1684 --- NEWS | 3 +++ imap.c | 40 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index fbebfaf5..3d44c352 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,9 @@ fetchmail-4.4.0 (): under Red Hat 5.0. * Kerberos V support from Jon Dugan and Von Welch . +* Ron Kaminsky sent a patch to RFC1730-encode passwords + sent to IMAP servers. This allows them to contain doublequotes and + backslashes. There are 269 people on fetchmail-friends and 144 on fetchmail-announce. diff --git a/imap.c b/imap.c index 66f42c8a..85aea358 100644 --- a/imap.c +++ b/imap.c @@ -562,6 +562,28 @@ static int do_gssauth(int sock, char *hostname, char *username) } #endif /* GSSAPI */ +static char *canonify_imap_password(char *passwd) +/* encode an IMAP password as per RFC1730's quoting conventions */ +{ + char *result; + int i, j; + + result = malloc(2*strlen(passwd)); + if (!result) + return 0; + + j=0; + for (i=0; iremotename, ctl->password); - if (ok) - return(ok); - + { + char *newpass = canonify_imap_password(ctl->password); + + if (!newpass) + return(PS_AUTHFAIL); /* should report error better!!!! */ + + ok = gen_transact(sock, "LOGIN %s \"%s\"", ctl->remotename, newpass); + + free(newpass); + + if (ok) + return(ok); + } + return(PS_SUCCESS); } -- cgit v1.2.3