aboutsummaryrefslogtreecommitdiff
path: root/lib/pop3.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-10-30 20:56:38 +0000
committerSteve Holme <steve_holme@hotmail.com>2013-10-30 20:58:24 +0000
commit43400b40862ea274d501f6692beb28a72ec7f776 (patch)
tree73f6d0074bc1e54896ebef1a79d40cc0170496d5 /lib/pop3.c
parent8179354c2f8b0c14287b73eb80e7c954be45543c (diff)
email: Post graceful SASL authentication cancellation tidy up
Diffstat (limited to 'lib/pop3.c')
-rw-r--r--lib/pop3.c85
1 files changed, 35 insertions, 50 deletions
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;
}