aboutsummaryrefslogtreecommitdiff
path: root/lib/smtp.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-02-09 14:32:20 +0000
committerSteve Holme <steve_holme@hotmail.com>2013-02-09 14:32:20 +0000
commit62bd21746443f631e7b47f675aa80b3f0786a805 (patch)
treef27d2db2f509313e50beaa7470bc988ba7b339b6 /lib/smtp.c
parentf0bfc0fbd7b06b1a54d3379b6da4f708fd0837a1 (diff)
smtp: Fixed an issue when processing EHLO failure responses (Part 2)
Follow up fix to commit 23d17190ee32 as EHLO capabilities can exist within a positive response line.
Diffstat (limited to 'lib/smtp.c')
-rw-r--r--lib/smtp.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/smtp.c b/lib/smtp.c
index fac03c94a..fd8d71226 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -213,19 +213,18 @@ static int smtp_endofresp(struct pingpong *pp, int *resp)
size_t len = strlen(pp->linestart_resp);
struct connectdata *conn = pp->conn;
struct smtp_conn *smtpc = &conn->proto.smtpc;
+ int result = FALSE;
size_t wordlen;
if(len < 4 || !ISDIGIT(line[0]) || !ISDIGIT(line[1]) || !ISDIGIT(line[2]))
return FALSE; /* Nothing for us */
/* Do we have a command response? */
- if(line[3] == ' ') {
+ if((result = (line[3] == ' ')) != 0)
*resp = curlx_sltosi(strtol(line, NULL, 10));
- return TRUE;
- }
/* Are we processing EHLO command data? */
- if(smtpc->state == SMTP_EHLO) {
+ if(smtpc->state == SMTP_EHLO && (!result || (result && *resp == 250))) {
line += 4;
len -= 4;
@@ -281,7 +280,7 @@ static int smtp_endofresp(struct pingpong *pp, int *resp)
}
}
- return FALSE;
+ return result;
}
/* This is the ONLY way to change SMTP state! */