summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-09-21 09:17:06 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-09-21 09:17:06 +0200
commita5ba499763d921181cd24c2c6aaacf78883a17f1 (patch)
treee4e8d37b2d42a82dabe38fb482b52fa9ea13bf98
parente027acc836c5c2acea44bb168f246b3bd0354fb3 (diff)
downloadcurl-bagder/tests-imap-server-auth.tar.gz
imap: quote atoms properly when escaping charactersbagder/tests-imap-server-auth
Updates test 800 to verify Fixes #1902
-rw-r--r--lib/imap.c4
-rw-r--r--tests/data/test8004
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/imap.c b/lib/imap.c
index d37113aae..954d18f37 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -1797,7 +1797,7 @@ static char *imap_atom(const char *str, bool escape_only)
return strdup(str);
/* Calculate the new string length */
- newlen = strlen(str) + backsp_count + quote_count + (others_exists ? 2 : 0);
+ newlen = strlen(str) + backsp_count + quote_count + (escape_only ? 0 : 2);
/* Allocate the new string */
newstr = (char *) malloc((newlen + 1) * sizeof(char));
@@ -1806,7 +1806,7 @@ static char *imap_atom(const char *str, bool escape_only)
/* Surround the string in quotes if necessary */
p2 = newstr;
- if(others_exists) {
+ if(!escape_only) {
newstr[0] = '"';
newstr[newlen - 1] = '"';
p2++;
diff --git a/tests/data/test800 b/tests/data/test800
index 1ac1da59b..360206b43 100644
--- a/tests/data/test800
+++ b/tests/data/test800
@@ -31,7 +31,7 @@ imap
IMAP FETCH message
</name>
<command>
-'imap://%HOSTIP:%IMAPPORT/800/;UID=1' -u "user*:secret{"
+'imap://%HOSTIP:%IMAPPORT/800/;UID=1' -u '"user:sec"ret{'
</command>
</client>
@@ -40,7 +40,7 @@ IMAP FETCH message
<verify>
<protocol>
A001 CAPABILITY
-A002 LOGIN "user*" "secret{"
+A002 LOGIN "\"user" "sec\"ret{"
A003 SELECT 800
A004 FETCH 1 BODY[]
A005 LOGOUT