aboutsummaryrefslogtreecommitdiff
path: root/lib/smtp.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-02-09 00:22:25 +0000
committerSteve Holme <steve_holme@hotmail.com>2013-02-09 00:22:25 +0000
commit23d17190ee3273b0718e0ca62f73bacf257088cf (patch)
treed57cf00b0fa82214bf474a7391a1ecc5729cf83c /lib/smtp.c
parent21657823ea3df5d55ddf3ce290d8468858aee1a4 (diff)
smtp: Fixed an issue when processing EHLO failure responses
Fixed a small issue where smtp_endofresp() would look for capabilities in the description part of a failure response. In theory a server shouldn't respond with SIZE or AUTH in an EHLO command's failure response but if it did then capabilities would be unnecessarily set before eventually failing.
Diffstat (limited to 'lib/smtp.c')
-rw-r--r--lib/smtp.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/smtp.c b/lib/smtp.c
index 86d45d12c..c967bbd68 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -213,17 +213,18 @@ static int smtp_endofresp(struct pingpong *pp, int *resp)
size_t len = pp->nread_resp;
struct connectdata *conn = pp->conn;
struct smtp_conn *smtpc = &conn->proto.smtpc;
- int result;
size_t wordlen;
if(len < 4 || !ISDIGIT(line[0]) || !ISDIGIT(line[1]) || !ISDIGIT(line[2]))
return FALSE; /* Nothing for us */
- /* Extract the response code if necessary */
- if((result = (line[3] == ' ')) != 0)
+ /* Do we have a command response? */
+ if(line[3] == ' ') {
*resp = curlx_sltosi(strtol(line, NULL, 10));
+ return TRUE;
+ }
- /* Are we processing EHLO command responses? */
+ /* Are we processing EHLO command data? */
if(smtpc->state == SMTP_EHLO) {
line += 4;
len -= 4;
@@ -276,7 +277,7 @@ static int smtp_endofresp(struct pingpong *pp, int *resp)
}
}
- return result;
+ return FALSE;
}
/* This is the ONLY way to change SMTP state! */