aboutsummaryrefslogtreecommitdiff
path: root/lib/smtp.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-02-04 23:51:36 +0000
committerSteve Holme <steve_holme@hotmail.com>2013-02-04 23:51:36 +0000
commit022e67294eb6b39f8d2554abc178a1328e8b9cd5 (patch)
treeb0b4a23409b258f28e54addffe6f93057cc42410 /lib/smtp.c
parent7fd5f680ea5cb0962c897977e427464858bff151 (diff)
email: Provided extra comments following recent pop3/imap fixes
Provided additional clarification about the logic of the authenticate() functions following commit 6b6bdc83bd36 and b4270a9af1d0.
Diffstat (limited to 'lib/smtp.c')
-rw-r--r--lib/smtp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/smtp.c b/lib/smtp.c
index 6204de0e8..02048b05d 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -373,8 +373,8 @@ static CURLcode smtp_authenticate(struct connectdata *conn)
return result;
}
- /* Check supported authentication mechanisms by decreasing order of
- security */
+ /* Calculate the supported authentication mechanism, by decreasing order of
+ security, as well as the initial response where appropriate */
#ifndef CURL_DISABLE_CRYPTO_AUTH
if(smtpc->authmechs & SASL_MECH_DIGEST_MD5) {
mech = "DIGEST-MD5";
@@ -417,11 +417,13 @@ static CURLcode smtp_authenticate(struct connectdata *conn)
conn->passwd, &initresp, &len);
}
else {
+ /* Other mechanisms not supported */
infof(conn->data, "No known authentication mechanisms supported!\n");
- result = CURLE_LOGIN_DENIED; /* Other mechanisms not supported */
+ result = CURLE_LOGIN_DENIED;
}
if(!result) {
+ /* Perform SASL based authentication */
if(initresp &&
strlen(mech) + len <= 512 - 8) { /* AUTH <mech> ...<crlf> */
result = Curl_pp_sendf(&smtpc->pp, "AUTH %s %s", mech, initresp);
@@ -435,6 +437,7 @@ static CURLcode smtp_authenticate(struct connectdata *conn)
if(!result)
state(conn, state1);
}
+
Curl_safefree(initresp);
}