From f77a4eaa0c360870aa4cb7714203cbcec93f5d20 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 18 Mar 1998 18:10:41 +0000 Subject: Fix IMAP password shrouding. svn path=/trunk/; revision=1712 --- imap.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) (limited to 'imap.c') diff --git a/imap.c b/imap.c index 29ce0de9..227565cd 100644 --- a/imap.c +++ b/imap.c @@ -568,18 +568,13 @@ static int do_gssauth(int sock, char *hostname, char *username) } #endif /* GSSAPI */ -static char *canonicalize_imap_password(char *passwd) +int imap_canonicalize(char *result, 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; ipassword); - - 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); - } + imap_canonicalize(password, ctl->password); + ok = gen_transact(sock, "LOGIN \"%s\" \"%s\"", ctl->remotename, password); + if (ok) + return(ok); return(PS_SUCCESS); } @@ -996,6 +982,7 @@ const static struct method imap = TRUE, /* this is a tagged protocol */ FALSE, /* no message delimiter */ imap_ok, /* parse command response */ + imap_canonicalize, /* deal with embedded slashes and spaces */ imap_getauth, /* get authorization */ imap_getrange, /* query range of messages */ imap_getsizes, /* get sizes of messages (used for --limit option */ -- cgit v1.2.3