1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

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.
This commit is contained in:
Steve Holme 2013-04-28 12:57:42 +01:00
parent 1d7c38e1f0
commit 9ea5145952
3 changed files with 69 additions and 70 deletions

View File

@ -596,9 +596,7 @@ static CURLcode imap_perform_authenticate(struct connectdata *conn)
conn->passwd, &initresp, &len);
}
if(result)
return result;
if(!result) {
if(mech) {
/* Perform SASL based authentication */
if(initresp) {
@ -624,6 +622,7 @@ static CURLcode imap_perform_authenticate(struct connectdata *conn)
infof(conn->data, "No known authentication mechanisms supported!\n");
result = CURLE_LOGIN_DENIED;
}
}
return result;
}

View File

@ -624,9 +624,7 @@ 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 &&
@ -637,7 +635,6 @@ static CURLcode pop3_perform_authenticate(struct connectdata *conn)
state(conn, state2);
}
else {
/* Perform SASL based authentication */
result = Curl_pp_sendf(&pop3c->pp, "AUTH %s", mech);
if(!result)
@ -661,6 +658,7 @@ static CURLcode pop3_perform_authenticate(struct connectdata *conn)
infof(conn->data, "No known authentication mechanisms supported!\n");
result = CURLE_LOGIN_DENIED;
}
}
return result;
}

View File

@ -518,13 +518,9 @@ 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) {
if(mech) {
/* Perform SASL based authentication */
if(initresp &&
8 + strlen(mech) + len <= 512) { /* AUTH <mech> ...<crlf> */
@ -542,6 +538,12 @@ static CURLcode smtp_perform_authenticate(struct connectdata *conn)
Curl_safefree(initresp);
}
else {
/* Other mechanisms not supported */
infof(conn->data, "No known authentication mechanisms supported!\n");
result = CURLE_LOGIN_DENIED;
}
}
return result;
}