diff options
Diffstat (limited to 'lib/imap.c')
-rw-r--r-- | lib/imap.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/lib/imap.c b/lib/imap.c index 6bdd5c1ae..b13bd3da7 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -596,33 +596,32 @@ static CURLcode imap_perform_authenticate(struct connectdata *conn) conn->passwd, &initresp, &len); } - if(result) - return result; + if(!result) { + if(mech) { + /* Perform SASL based authentication */ + if(initresp) { + result = imap_sendf(conn, "AUTHENTICATE %s %s", mech, initresp); - if(mech) { - /* Perform SASL based authentication */ - if(initresp) { - result = imap_sendf(conn, "AUTHENTICATE %s %s", mech, initresp); + if(!result) + state(conn, state2); + } + else { + result = imap_sendf(conn, "AUTHENTICATE %s", mech); - if(!result) - state(conn, state2); + if(!result) + state(conn, state1); + } + + Curl_safefree(initresp); } + else if(!imapc->login_disabled) + /* Perform clear text authentication */ + result = imap_perform_login(conn); else { - result = imap_sendf(conn, "AUTHENTICATE %s", mech); - - if(!result) - state(conn, state1); + /* Other mechanisms not supported */ + infof(conn->data, "No known authentication mechanisms supported!\n"); + result = CURLE_LOGIN_DENIED; } - - Curl_safefree(initresp); - } - else if(!imapc->login_disabled) - /* Perform clear text authentication */ - result = imap_perform_login(conn); - else { - /* Other mechanisms not supported */ - infof(conn->data, "No known authentication mechanisms supported!\n"); - result = CURLE_LOGIN_DENIED; } return result; |