aboutsummaryrefslogtreecommitdiff
path: root/lib/smtp.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-04-28 12:57:42 +0100
committerSteve Holme <steve_holme@hotmail.com>2013-04-28 12:57:42 +0100
commit9ea51459520d5d8a397908b4a3fc6cc3b2d45974 (patch)
tree750645eda5920ee4f61ee8b2e2b7b3a5a99932c0 /lib/smtp.c
parent1d7c38e1f06710338db5f29e67d6dff668747aca (diff)
email: Tidy up of *_perform_authenticate()
Removed the hard returns from imap and pop3 by using the same style for sending the authentication string as smtp. Moved the "Other mechanisms not supported" check in smtp to match that of imap and pop3 to provide consistency between the three email protocols.
Diffstat (limited to 'lib/smtp.c')
-rw-r--r--lib/smtp.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/lib/smtp.c b/lib/smtp.c
index 72b3bbf6a..72a6135ff 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -518,29 +518,31 @@ static CURLcode smtp_perform_authenticate(struct connectdata *conn)
result = Curl_sasl_create_plain_message(conn->data, conn->user,
conn->passwd, &initresp, &len);
}
- else {
- /* Other mechanisms not supported */
- infof(conn->data, "No known authentication mechanisms supported!\n");
- result = CURLE_LOGIN_DENIED;
- }
if(!result) {
- /* Perform SASL based authentication */
- if(initresp &&
- 8 + strlen(mech) + len <= 512) { /* AUTH <mech> ...<crlf> */
- result = Curl_pp_sendf(&smtpc->pp, "AUTH %s %s", mech, initresp);
+ if(mech) {
+ /* Perform SASL based authentication */
+ if(initresp &&
+ 8 + strlen(mech) + len <= 512) { /* AUTH <mech> ...<crlf> */
+ result = Curl_pp_sendf(&smtpc->pp, "AUTH %s %s", mech, initresp);
- if(!result)
- state(conn, state2);
+ if(!result)
+ state(conn, state2);
+ }
+ else {
+ result = Curl_pp_sendf(&smtpc->pp, "AUTH %s", mech);
+
+ if(!result)
+ state(conn, state1);
+ }
+
+ Curl_safefree(initresp);
}
else {
- result = Curl_pp_sendf(&smtpc->pp, "AUTH %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);
}
return result;