diff options
author | Steve Holme <steve_holme@hotmail.com> | 2013-10-30 20:56:38 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2013-10-30 20:58:24 +0000 |
commit | 43400b40862ea274d501f6692beb28a72ec7f776 (patch) | |
tree | 73f6d0074bc1e54896ebef1a79d40cc0170496d5 /lib/imap.c | |
parent | 8179354c2f8b0c14287b73eb80e7c954be45543c (diff) |
email: Post graceful SASL authentication cancellation tidy up
Diffstat (limited to 'lib/imap.c')
-rw-r--r-- | lib/imap.c | 85 |
1 files changed, 35 insertions, 50 deletions
diff --git a/lib/imap.c b/lib/imap.c index c11e43bd6..60e7489df 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -1007,20 +1007,17 @@ static CURLcode imap_state_auth_plain_resp(struct connectdata *conn, /* Create the authorisation message */ result = Curl_sasl_create_plain_message(data, conn->user, conn->passwd, &plainauth, &len); + if(!result && plainauth) { + /* Send the message */ + result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", plainauth); - /* Send the message */ - if(!result) { - if(plainauth) { - result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", plainauth); - - if(!result) - state(conn, IMAP_AUTHENTICATE_FINAL); - } - - Curl_safefree(plainauth); + if(!result) + state(conn, IMAP_AUTHENTICATE_FINAL); } } + Curl_safefree(plainauth); + return result; } @@ -1044,20 +1041,17 @@ static CURLcode imap_state_auth_login_resp(struct connectdata *conn, /* Create the user message */ result = Curl_sasl_create_login_message(data, conn->user, &authuser, &len); + if(!result && authuser) { + /* Send the user */ + result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", authuser); - /* Send the user */ - if(!result) { - if(authuser) { - result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", authuser); - - if(!result) - state(conn, IMAP_AUTHENTICATE_LOGIN_PASSWD); - } - - Curl_safefree(authuser); + if(!result) + state(conn, IMAP_AUTHENTICATE_LOGIN_PASSWD); } } + Curl_safefree(authuser); + return result; } @@ -1081,20 +1075,17 @@ static CURLcode imap_state_auth_login_password_resp(struct connectdata *conn, /* Create the password message */ result = Curl_sasl_create_login_message(data, conn->passwd, &authpasswd, &len); + if(!result && authpasswd) { + /* Send the password */ + result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", authpasswd); - /* Send the password */ - if(!result) { - if(authpasswd) { - result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", authpasswd); - - if(!result) - state(conn, IMAP_AUTHENTICATE_FINAL); - } - - Curl_safefree(authpasswd); + if(!result) + state(conn, IMAP_AUTHENTICATE_FINAL); } } + Curl_safefree(authpasswd); + return result; } @@ -1252,20 +1243,17 @@ static CURLcode imap_state_auth_ntlm_resp(struct connectdata *conn, result = Curl_sasl_create_ntlm_type1_message(conn->user, conn->passwd, &conn->ntlm, &type1msg, &len); + if(!result && type1msg) { + /* Send the message */ + result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", type1msg); - /* Send the message */ - if(!result) { - if(type1msg) { - result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", type1msg); - - if(!result) - state(conn, IMAP_AUTHENTICATE_NTLM_TYPE2MSG); - } - - Curl_safefree(type1msg); + if(!result) + state(conn, IMAP_AUTHENTICATE_NTLM_TYPE2MSG); } } + Curl_safefree(type1msg); + return result; } @@ -1341,20 +1329,17 @@ static CURLcode imap_state_auth_xoauth2_resp(struct connectdata *conn, result = Curl_sasl_create_xoauth2_message(conn->data, conn->user, conn->xoauth2_bearer, &xoauth, &len); + if(!result && xoauth) { + /* Send the message */ + result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", xoauth); - /* Send the message */ - if(!result) { - if(xoauth) { - result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", xoauth); - - if(!result) - state(conn, IMAP_AUTHENTICATE_FINAL); - } - - Curl_safefree(xoauth); + if(!result) + state(conn, IMAP_AUTHENTICATE_FINAL); } } + Curl_safefree(xoauth); + return result; } |