smtp_state_upgrade_tls() would attempt to incorrectly complete the
upgrade to smtps and start the EHLO command if
Curl_ssl_connect_nonblocking() returned a failure code and if ssldone
was set to TRUE. This would only happen when a non-blocking API hadn't
been provided by the SSL implementation and curlssl_connect() was
called underneath.
else
result = smtp_authenticate(conn);
}
- else {
- state(conn, SMTP_UPGRADETLS);
+ else
result = smtp_state_upgrade_tls(conn);
- }
return result;
}
result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &smtpc->ssldone);
- if(smtpc->ssldone) {
- smtp_to_smtps(conn);
- result = smtp_state_ehlo(conn);
+ if(!result) {
+ if(smtpc->state != SMTP_UPGRADETLS)
+ state(conn, SMTP_UPGRADETLS);
+
+ if(smtpc->ssldone) {
+ smtp_to_smtps(conn);
+ result = smtp_state_ehlo(conn);
+ }
}
return result;