From 43400b40862ea274d501f6692beb28a72ec7f776 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Wed, 30 Oct 2013 20:56:38 +0000 Subject: email: Post graceful SASL authentication cancellation tidy up --- lib/pop3.c | 85 ++++++++++++++++++++++++++------------------------------------ 1 file changed, 35 insertions(+), 50 deletions(-) (limited to 'lib/pop3.c') diff --git a/lib/pop3.c b/lib/pop3.c index b22d66e05..cc067d67c 100644 --- a/lib/pop3.c +++ b/lib/pop3.c @@ -865,20 +865,17 @@ static CURLcode pop3_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.pop3c.pp, "%s", plainauth); - /* Send the message */ - if(!result) { - if(plainauth) { - result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", plainauth); - - if(!result) - state(conn, POP3_AUTH_FINAL); - } - - Curl_safefree(plainauth); + if(!result) + state(conn, POP3_AUTH_FINAL); } } + Curl_safefree(plainauth); + return result; } @@ -902,20 +899,17 @@ static CURLcode pop3_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.pop3c.pp, "%s", authuser); - /* Send the user */ - if(!result) { - if(authuser) { - result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", authuser); - - if(!result) - state(conn, POP3_AUTH_LOGIN_PASSWD); - } - - Curl_safefree(authuser); + if(!result) + state(conn, POP3_AUTH_LOGIN_PASSWD); } } + Curl_safefree(authuser); + return result; } @@ -939,20 +933,17 @@ static CURLcode pop3_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.pop3c.pp, "%s", authpasswd); - /* Send the password */ - if(!result) { - if(authpasswd) { - result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", authpasswd); - - if(!result) - state(conn, POP3_AUTH_FINAL); - } - - Curl_safefree(authpasswd); + if(!result) + state(conn, POP3_AUTH_FINAL); } } + Curl_safefree(authpasswd); + return result; } @@ -1110,20 +1101,17 @@ static CURLcode pop3_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.pop3c.pp, "%s", type1msg); - /* Send the message */ - if(!result) { - if(type1msg) { - result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", type1msg); - - if(!result) - state(conn, POP3_AUTH_NTLM_TYPE2MSG); - } - - Curl_safefree(type1msg); + if(!result) + state(conn, POP3_AUTH_NTLM_TYPE2MSG); } } + Curl_safefree(type1msg); + return result; } @@ -1198,20 +1186,17 @@ static CURLcode pop3_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.pop3c.pp, "%s", xoauth); - /* Send the message */ - if(!result) { - if(xoauth) { - result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", xoauth); - - if(!result) - state(conn, POP3_AUTH_FINAL); - } - - Curl_safefree(xoauth); + if(!result) + state(conn, POP3_AUTH_FINAL); } } + Curl_safefree(xoauth); + return result; } -- cgit v1.2.3