aboutsummaryrefslogtreecommitdiff
path: root/lib/smtp.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-10-26 11:09:31 +0100
committerSteve Holme <steve_holme@hotmail.com>2013-10-26 11:09:31 +0100
commit2766262a68688c1dd8143f9c4be84b46c408b70a (patch)
treedb1ffea736c885828b4b295ffa585ea3c4bf8f0c /lib/smtp.c
parentbdb1f0e53d2f34b9a2b46fea2a683214ee26b320 (diff)
smtp: Fixed response code parsing for bad AUTH continuation responses
This workaround had been previously been implemented for IMAP and POP3 but not SMTP. Some of the recent test case additions implemented this behaviour to emulate a bad server and the SMTP code didn't cope with it.
Diffstat (limited to 'lib/smtp.c')
-rw-r--r--lib/smtp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/smtp.c b/lib/smtp.c
index f82c8aac2..a5b3bf8c6 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -234,8 +234,11 @@ static bool smtp_endofresp(struct connectdata *conn, char *line, size_t len,
if(len < 4 || !ISDIGIT(line[0]) || !ISDIGIT(line[1]) || !ISDIGIT(line[2]))
return FALSE; /* Nothing for us */
- /* Do we have a command response? */
- result = (line[3] == ' ') ? TRUE : FALSE;
+ /* Do we have a command response? This should be the response code followed
+ by a space and optionally some text as per RFC-5321 and as outlined in
+ Section 4. Examples of RFC-4954 but some e-mail servers ignore this and
+ only send the response code instead. */
+ result = (line[3] == ' ' || len == 5) ? TRUE : FALSE;
if(result)
*resp = curlx_sltosi(strtol(line, NULL, 10));