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.
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));