]> granicus.if.org Git - curl/commitdiff
smtp.c: Fixed unnecessary state change if starttls fails
authorSteve Holme <steve_holme@hotmail.com>
Sun, 27 Jan 2013 10:44:21 +0000 (10:44 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Sun, 27 Jan 2013 10:44:21 +0000 (10:44 +0000)
The state machine should only be changed to SMTP_STARTTLS when the
STARTTLS command has been successfully sent to the server.

lib/smtp.c

index 2433a64474f1fda08adcd93893f1a2c4651f5695..6204de0e8bdd649be5ad4a8c08b1520d8e647b31 100644 (file)
@@ -543,7 +543,8 @@ static CURLcode smtp_state_ehlo_resp(struct connectdata *conn, int smtpcode,
     /* We don't have a SSL/TLS connection yet, but SSL is requested. Switch
        to TLS connection now */
     result = Curl_pp_sendf(&conn->proto.smtpc.pp, "STARTTLS");
-    state(conn, SMTP_STARTTLS);
+    if(!result)
+      state(conn, SMTP_STARTTLS);
   }
   else
     result = smtp_authenticate(conn);