]> granicus.if.org Git - curl/commitdiff
smtp: Fixed handling of multiline server greeting responses
authorSteve Holme <steve_holme@hotmail.com>
Fri, 15 Nov 2013 12:50:37 +0000 (12:50 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Fri, 15 Nov 2013 12:50:37 +0000 (12:50 +0000)
Incorrectly processed multiline server greeting responses as "wanted"
continue responses in smtp_endofresp(), from commit f16c0de4e9bbe3,
which in turn broke the SMTP server detection in the test suite,
because the EHLO command would not be sent.

lib/smtp.c

index 1db28478abc9ec941fdce75bb208f7b8e47551cf..e18947ec1d4329ea02e0d4cf62561444b435c799 100644 (file)
@@ -228,6 +228,7 @@ static void smtp_to_smtps(struct connectdata *conn)
 static bool smtp_endofresp(struct connectdata *conn, char *line, size_t len,
                            int *resp)
 {
+  struct smtp_conn *smtpc = &conn->proto.smtpc;
   bool result = FALSE;
 
   /* Nothing for us */
@@ -247,7 +248,7 @@ static bool smtp_endofresp(struct connectdata *conn, char *line, size_t len,
       *resp = 0;
   }
   /* Do we have a multiline (continuation) response? */
-  else if(line[3] == '-') {
+  else if(line[3] == '-' && smtpc->state == SMTP_EHLO) {
     result = TRUE;
     *resp = 1;  /* Internal response code */
   }