aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-01-24 20:24:39 +0000
committerSteve Holme <steve_holme@hotmail.com>2013-01-24 20:24:39 +0000
commit8b275718e225c67bf21e078775f005d56f122589 (patch)
treef665d779fbc748f5eeaaf696ea3e5b5d765042c6 /lib
parent379d63ecc7e361fcfea5ef40881307b497e0c625 (diff)
pop3.c: Fixed failure detection during TLS upgrade
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/pop3.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/pop3.c b/lib/pop3.c
index eabcd3004..9a9e81b20 100644
--- a/lib/pop3.c
+++ b/lib/pop3.c
@@ -568,10 +568,8 @@ static CURLcode pop3_state_starttls_resp(struct connectdata *conn,
else
result = pop3_state_capa(conn);
}
- else {
- state(conn, POP3_UPGRADETLS);
+ else
result = pop3_state_upgrade_tls(conn);
- }
return result;
}
@@ -583,9 +581,14 @@ static CURLcode pop3_state_upgrade_tls(struct connectdata *conn)
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;