aboutsummaryrefslogtreecommitdiff
path: root/lib/pop3.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/pop3.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/pop3.c')
-rw-r--r--lib/pop3.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/lib/pop3.c b/lib/pop3.c
index bace72a11..6f188b254 100644
--- a/lib/pop3.c
+++ b/lib/pop3.c
@@ -624,42 +624,40 @@ static CURLcode pop3_perform_authenticate(struct connectdata *conn)
}
}
- if(result)
- return result;
+ if(!result) {
+ if(mech && (pop3c->preftype & POP3_TYPE_SASL)) {
+ /* Perform SASL based authentication */
+ if(initresp &&
+ 8 + strlen(mech) + len <= 255) { /* AUTH <mech> ...<crlf> */
+ result = Curl_pp_sendf(&pop3c->pp, "AUTH %s %s", mech, initresp);
- if(mech && (pop3c->preftype & POP3_TYPE_SASL)) {
- /* Perform SASL based authentication */
- if(initresp &&
- 8 + strlen(mech) + len <= 255) { /* AUTH <mech> ...<crlf> */
- result = Curl_pp_sendf(&pop3c->pp, "AUTH %s %s", mech, initresp);
+ if(!result)
+ state(conn, state2);
+ }
+ else {
+ result = Curl_pp_sendf(&pop3c->pp, "AUTH %s", mech);
- if(!result)
- state(conn, state2);
- }
- else {
- /* Perform SASL based authentication */
- result = Curl_pp_sendf(&pop3c->pp, "AUTH %s", mech);
+ if(!result)
+ state(conn, state1);
+ }
- if(!result)
- state(conn, state1);
+ Curl_safefree(initresp);
}
-
- Curl_safefree(initresp);
- }
#ifndef CURL_DISABLE_CRYPTO_AUTH
- else if((pop3c->authtypes & POP3_TYPE_APOP) &&
- (pop3c->preftype & POP3_TYPE_APOP))
- /* Perform APOP authentication */
- result = pop3_perform_apop(conn);
+ else if((pop3c->authtypes & POP3_TYPE_APOP) &&
+ (pop3c->preftype & POP3_TYPE_APOP))
+ /* Perform APOP authentication */
+ result = pop3_perform_apop(conn);
#endif
- else if((pop3c->authtypes & POP3_TYPE_CLEARTEXT) &&
- (pop3c->preftype & POP3_TYPE_CLEARTEXT))
- /* Perform clear text authentication */
- result = pop3_perform_user(conn);
- else {
- /* Other mechanisms not supported */
- infof(conn->data, "No known authentication mechanisms supported!\n");
- result = CURLE_LOGIN_DENIED;
+ else if((pop3c->authtypes & POP3_TYPE_CLEARTEXT) &&
+ (pop3c->preftype & POP3_TYPE_CLEARTEXT))
+ /* Perform clear text authentication */
+ result = pop3_perform_user(conn);
+ else {
+ /* Other mechanisms not supported */
+ infof(conn->data, "No known authentication mechanisms supported!\n");
+ result = CURLE_LOGIN_DENIED;
+ }
}
return result;