pop3_state_upgrade_tls() would attempt to incorrectly complete the
upgrade to pop3s and start the CAPA 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 = pop3_state_capa(conn);
}
- else {
- state(conn, POP3_UPGRADETLS);
+ else
result = pop3_state_upgrade_tls(conn);
- }
return result;
}
result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &pop3c->ssldone);
- if(pop3c->ssldone) {
- pop3_to_pop3s(conn);
- result = pop3_state_capa(conn);
+ if(!result) {
+ if(pop3c->state != POP3_UPGRADETLS)
+ state(conn, POP3_UPGRADETLS);
+
+ if(pop3c->ssldone) {
+ pop3_to_pop3s(conn);
+ result = pop3_state_capa(conn);
+ }
}
return result;