Commit 277022b2 authored by Steve Holme's avatar Steve Holme Committed by Daniel Stenberg
Browse files

Fixed incorrect error code being returned in STARTTLS

The STARTTLS response code in SMTP, POP3 and IMAP would return
CURLE_LOGIN_DENIED rather than CURLE_USE_SSL_FAILED when SSL/TLS
was not available on the server.

Reported by: Gokhan Sengun
Bug: http://curl.haxx.se/mail/lib-2012-01/0018.html
parent 0f8239d5
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -355,7 +355,7 @@ static CURLcode imap_state_starttls_resp(struct connectdata *conn,


  if(imapcode != 'O') {
  if(imapcode != 'O') {
    failf(data, "STARTTLS denied. %c", imapcode);
    failf(data, "STARTTLS denied. %c", imapcode);
    result = CURLE_LOGIN_DENIED;
    result = CURLE_USE_SSL_FAILED;
  }
  }
  else {
  else {
    if(data->state.used_interface == Curl_if_multi) {
    if(data->state.used_interface == Curl_if_multi) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -299,7 +299,7 @@ static CURLcode pop3_state_starttls_resp(struct connectdata *conn,


  if(pop3code != 'O') {
  if(pop3code != 'O') {
    failf(data, "STARTTLS denied. %c", pop3code);
    failf(data, "STARTTLS denied. %c", pop3code);
    result = CURLE_LOGIN_DENIED;
    result = CURLE_USE_SSL_FAILED;
    state(conn, POP3_STOP);
    state(conn, POP3_STOP);
  }
  }
  else {
  else {
+1 −1
Original line number Original line Diff line number Diff line
@@ -510,7 +510,7 @@ static CURLcode smtp_state_starttls_resp(struct connectdata *conn,
  if(smtpcode != 220) {
  if(smtpcode != 220) {
    if(data->set.use_ssl != CURLUSESSL_TRY) {
    if(data->set.use_ssl != CURLUSESSL_TRY) {
      failf(data, "STARTTLS denied. %c", smtpcode);
      failf(data, "STARTTLS denied. %c", smtpcode);
      result = CURLE_LOGIN_DENIED;
      result = CURLE_USE_SSL_FAILED;
    }
    }
    else
    else
      result = smtp_authenticate(conn);
      result = smtp_authenticate(conn);