aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2012-12-29 19:23:10 +0000
committerSteve Holme <steve_holme@hotmail.com>2012-12-29 19:23:10 +0000
commit488245f99c541258ca4b35209e17da69e52e4460 (patch)
tree5c5908ae174d3c6720a2b962c4122e24d6128b53 /lib
parent27f90c09626658cab41b06f9b4c3cb8587fc7fcb (diff)
imap.c: Fixed bad state error when logging in with invalid credentials
Fixed a problem with the state machine when attempting to log in with invalid credentials. The server would report login failure but libcurl would not read the response due to inappropriate IMAP_STOP states being set after the login was sent.
Diffstat (limited to 'lib')
-rw-r--r--lib/imap.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/imap.c b/lib/imap.c
index 18a4b16f2..72ede7e45 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -462,7 +462,7 @@ static CURLcode imap_state_starttls_resp(struct connectdata *conn,
else {
if(data->state.used_interface == Curl_if_multi) {
state(conn, IMAP_UPGRADETLS);
- return imap_state_upgrade_tls(conn);
+ result = imap_state_upgrade_tls(conn);
}
else {
result = Curl_ssl_connect(conn, FIRSTSOCKET);
@@ -473,8 +473,6 @@ static CURLcode imap_state_starttls_resp(struct connectdata *conn,
}
}
- state(conn, IMAP_STOP);
-
return result;
}
@@ -488,7 +486,6 @@ static CURLcode imap_state_upgrade_tls(struct connectdata *conn)
if(imapc->ssldone) {
imap_to_imaps(conn);
result = imap_state_login(conn);
- state(conn, IMAP_STOP);
}
return result;
@@ -508,9 +505,9 @@ static CURLcode imap_state_login_resp(struct connectdata *conn,
failf(data, "Access denied. %c", imapcode);
result = CURLE_LOGIN_DENIED;
}
-
- /* End of connect phase */
- state(conn, IMAP_STOP);
+ else
+ /* End of connect phase */
+ state(conn, IMAP_STOP);
return result;
}
@@ -655,6 +652,7 @@ static CURLcode imap_state_fetch_resp(struct connectdata *conn,
/* We don't know how to parse this line */
result = CURLE_FTP_WEIRD_SERVER_REPLY; /* TODO: fix this code */
+ /* End of do phase */
state(conn, IMAP_STOP);
return result;