mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
smtp.c: Fixed failure detection during TLS upgrade
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.
This commit is contained in:
parent
8b275718e2
commit
f8ba1273af
@ -490,10 +490,8 @@ static CURLcode smtp_state_starttls_resp(struct connectdata *conn,
|
|||||||
else
|
else
|
||||||
result = smtp_authenticate(conn);
|
result = smtp_authenticate(conn);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
state(conn, SMTP_UPGRADETLS);
|
|
||||||
result = smtp_state_upgrade_tls(conn);
|
result = smtp_state_upgrade_tls(conn);
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -505,10 +503,15 @@ static CURLcode smtp_state_upgrade_tls(struct connectdata *conn)
|
|||||||
|
|
||||||
result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &smtpc->ssldone);
|
result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &smtpc->ssldone);
|
||||||
|
|
||||||
|
if(!result) {
|
||||||
|
if(smtpc->state != SMTP_UPGRADETLS)
|
||||||
|
state(conn, SMTP_UPGRADETLS);
|
||||||
|
|
||||||
if(smtpc->ssldone) {
|
if(smtpc->ssldone) {
|
||||||
smtp_to_smtps(conn);
|
smtp_to_smtps(conn);
|
||||||
result = smtp_state_ehlo(conn);
|
result = smtp_state_ehlo(conn);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user