1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

smtp: Added support for disabling the SASL initial response

Updated the default behaviour of sending the client's initial response in the AUTH
command to not send it and added support for CURLOPT_SASL_IR to allow the user to
specify including the response.

Related Bug: http://curl.haxx.se/mail/lib-2012-03/0114.html
Reported-by: Gokhan Sengun
This commit is contained in:
Steve Holme 2013-04-27 11:59:17 +01:00
parent 7cb6c31370
commit 70e30f6caa

View File

@ -448,6 +448,7 @@ static CURLcode smtp_perform_upgrade_tls(struct connectdata *conn)
static CURLcode smtp_perform_authenticate(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct SessionHandle *data = conn->data;
struct smtp_conn *smtpc = &conn->proto.smtpc;
const char *mech = NULL;
char *initresp = NULL;
@ -487,6 +488,8 @@ static CURLcode smtp_perform_authenticate(struct connectdata *conn)
state1 = SMTP_AUTH_NTLM;
state2 = SMTP_AUTH_NTLM_TYPE2MSG;
smtpc->authused = SASL_MECH_NTLM;
if(data->set.sasl_ir)
result = Curl_sasl_create_ntlm_type1_message(conn->user, conn->passwd,
&conn->ntlm,
&initresp, &len);
@ -499,6 +502,8 @@ static CURLcode smtp_perform_authenticate(struct connectdata *conn)
state1 = SMTP_AUTH_LOGIN;
state2 = SMTP_AUTH_LOGIN_PASSWD;
smtpc->authused = SASL_MECH_LOGIN;
if(data->set.sasl_ir)
result = Curl_sasl_create_login_message(conn->data, conn->user,
&initresp, &len);
}
@ -508,6 +513,8 @@ static CURLcode smtp_perform_authenticate(struct connectdata *conn)
state1 = SMTP_AUTH_PLAIN;
state2 = SMTP_AUTH_FINAL;
smtpc->authused = SASL_MECH_PLAIN;
if(data->set.sasl_ir)
result = Curl_sasl_create_plain_message(conn->data, conn->user,
conn->passwd, &initresp, &len);
}