mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
imap: quote atoms properly when escaping characters
Updates test 800 to verify Fixes #1902 Closes #1903
This commit is contained in:
parent
a4db3f7046
commit
3b05f79ef8
@ -1797,7 +1797,7 @@ static char *imap_atom(const char *str, bool escape_only)
|
|||||||
return strdup(str);
|
return strdup(str);
|
||||||
|
|
||||||
/* Calculate the new string length */
|
/* 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 */
|
/* Allocate the new string */
|
||||||
newstr = (char *) malloc((newlen + 1) * sizeof(char));
|
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 */
|
/* Surround the string in quotes if necessary */
|
||||||
p2 = newstr;
|
p2 = newstr;
|
||||||
if(others_exists) {
|
if(!escape_only) {
|
||||||
newstr[0] = '"';
|
newstr[0] = '"';
|
||||||
newstr[newlen - 1] = '"';
|
newstr[newlen - 1] = '"';
|
||||||
p2++;
|
p2++;
|
||||||
|
@ -31,7 +31,7 @@ imap
|
|||||||
IMAP FETCH message
|
IMAP FETCH message
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/800/;UID=1' -u "user*:secret{"
|
'imap://%HOSTIP:%IMAPPORT/800/;UID=1' -u '"user:sec"ret{'
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ IMAP FETCH message
|
|||||||
<verify>
|
<verify>
|
||||||
<protocol>
|
<protocol>
|
||||||
A001 CAPABILITY
|
A001 CAPABILITY
|
||||||
A002 LOGIN "user*" "secret{"
|
A002 LOGIN "\"user" "sec\"ret{"
|
||||||
A003 SELECT 800
|
A003 SELECT 800
|
||||||
A004 FETCH 1 BODY[]
|
A004 FETCH 1 BODY[]
|
||||||
A005 LOGOUT
|
A005 LOGOUT
|
||||||
|
Loading…
Reference in New Issue
Block a user