aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-04-27 11:59:17 +0100
committerSteve Holme <steve_holme@hotmail.com>2013-04-27 12:09:15 +0100
commit70e30f6caa5ca33fdcaa605a62b133ac1e3ad213 (patch)
tree420ecd809d82e951bea4e69432528185b65d1441
parent7cb6c3137009fa0b37acf977119f7b3d481b8ba2 (diff)
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
-rw-r--r--lib/smtp.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/smtp.c b/lib/smtp.c
index 79ec5f787..3e8441953 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -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,10 +488,12 @@ static CURLcode smtp_perform_authenticate(struct connectdata *conn)
state1 = SMTP_AUTH_NTLM;
state2 = SMTP_AUTH_NTLM_TYPE2MSG;
smtpc->authused = SASL_MECH_NTLM;
- result = Curl_sasl_create_ntlm_type1_message(conn->user, conn->passwd,
- &conn->ntlm,
- &initresp, &len);
- }
+
+ if(data->set.sasl_ir)
+ result = Curl_sasl_create_ntlm_type1_message(conn->user, conn->passwd,
+ &conn->ntlm,
+ &initresp, &len);
+ }
else
#endif
if((smtpc->authmechs & SASL_MECH_LOGIN) &&
@@ -499,8 +502,10 @@ static CURLcode smtp_perform_authenticate(struct connectdata *conn)
state1 = SMTP_AUTH_LOGIN;
state2 = SMTP_AUTH_LOGIN_PASSWD;
smtpc->authused = SASL_MECH_LOGIN;
- result = Curl_sasl_create_login_message(conn->data, conn->user,
- &initresp, &len);
+
+ if(data->set.sasl_ir)
+ result = Curl_sasl_create_login_message(conn->data, conn->user,
+ &initresp, &len);
}
else if((smtpc->authmechs & SASL_MECH_PLAIN) &&
(smtpc->prefmech & SASL_MECH_PLAIN)) {
@@ -508,8 +513,10 @@ static CURLcode smtp_perform_authenticate(struct connectdata *conn)
state1 = SMTP_AUTH_PLAIN;
state2 = SMTP_AUTH_FINAL;
smtpc->authused = SASL_MECH_PLAIN;
- result = Curl_sasl_create_plain_message(conn->data, conn->user,
- conn->passwd, &initresp, &len);
+
+ if(data->set.sasl_ir)
+ result = Curl_sasl_create_plain_message(conn->data, conn->user,
+ conn->passwd, &initresp, &len);
}
else {
/* Other mechanisms not supported */