This release includes the following changes:
o SSL: protocol version can be specified more precisely [1]
- o email: Added support for cancelling NTLM authentication
- o email: Added support for cancelling DIGEST-MD5 authentication
- o email: Added support for canceling CRAM-MD5 authentication
+ o imap/pop3/smtp: Added graceful cancellation of SASL authentication
o Add "Happy Eyeballs" for IPv4/IPv6 dual connect attempts
This release includes the following bugfixes:
/*
* Curl_sasl_create_xoauth2_message()
*
- * This is used to generate an already encoded XOAUTH2 message ready
- * for sending to the recipient.
+ * This is used to generate an already encoded OAuth 2.0 message ready for
+ * sending to the recipient.
*
* Parameters:
*
* data [in] - The session handle.
* user [in] - The user name.
- * bearer [in] - The XOAUTH Bearer token.
+ * bearer [in] - The bearer token.
* outptr [in/out] - The address where a pointer to newly allocated memory
* holding the result will be stored upon completion.
* outlen [out] - The length of the output message.
char **outptr, size_t *outlen)
{
CURLcode result = CURLE_OK;
- char *xoauth;
+ char *xoauth = NULL;
+ /* Generate the message */
xoauth = aprintf("user=%s\1auth=Bearer %s\1\1", user, bearer);
-
if(!xoauth)
return CURLE_OUT_OF_MEMORY;
/* Base64 encode the reply */
- result = Curl_base64_encode(data, xoauth, strlen(xoauth), outptr,
- outlen);
+ result = Curl_base64_encode(data, xoauth, strlen(xoauth), outptr, outlen);
Curl_safefree(xoauth);
/* Create the authorisation message */
result = Curl_sasl_create_plain_message(data, conn->user, conn->passwd,
&plainauth, &len);
+ if(!result && plainauth) {
+ /* Send the message */
+ result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", plainauth);
- /* Send the message */
- if(!result) {
- if(plainauth) {
- result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", plainauth);
-
- if(!result)
- state(conn, IMAP_AUTHENTICATE_FINAL);
- }
-
- Curl_safefree(plainauth);
+ if(!result)
+ state(conn, IMAP_AUTHENTICATE_FINAL);
}
}
+ Curl_safefree(plainauth);
+
return result;
}
/* Create the user message */
result = Curl_sasl_create_login_message(data, conn->user,
&authuser, &len);
+ if(!result && authuser) {
+ /* Send the user */
+ result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", authuser);
- /* Send the user */
- if(!result) {
- if(authuser) {
- result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", authuser);
-
- if(!result)
- state(conn, IMAP_AUTHENTICATE_LOGIN_PASSWD);
- }
-
- Curl_safefree(authuser);
+ if(!result)
+ state(conn, IMAP_AUTHENTICATE_LOGIN_PASSWD);
}
}
+ Curl_safefree(authuser);
+
return result;
}
/* Create the password message */
result = Curl_sasl_create_login_message(data, conn->passwd,
&authpasswd, &len);
+ if(!result && authpasswd) {
+ /* Send the password */
+ result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", authpasswd);
- /* Send the password */
- if(!result) {
- if(authpasswd) {
- result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", authpasswd);
-
- if(!result)
- state(conn, IMAP_AUTHENTICATE_FINAL);
- }
-
- Curl_safefree(authpasswd);
+ if(!result)
+ state(conn, IMAP_AUTHENTICATE_FINAL);
}
}
+ Curl_safefree(authpasswd);
+
return result;
}
result = Curl_sasl_create_ntlm_type1_message(conn->user, conn->passwd,
&conn->ntlm,
&type1msg, &len);
+ if(!result && type1msg) {
+ /* Send the message */
+ result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", type1msg);
- /* Send the message */
- if(!result) {
- if(type1msg) {
- result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", type1msg);
-
- if(!result)
- state(conn, IMAP_AUTHENTICATE_NTLM_TYPE2MSG);
- }
-
- Curl_safefree(type1msg);
+ if(!result)
+ state(conn, IMAP_AUTHENTICATE_NTLM_TYPE2MSG);
}
}
+ Curl_safefree(type1msg);
+
return result;
}
result = Curl_sasl_create_xoauth2_message(conn->data, conn->user,
conn->xoauth2_bearer,
&xoauth, &len);
+ if(!result && xoauth) {
+ /* Send the message */
+ result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", xoauth);
- /* Send the message */
- if(!result) {
- if(xoauth) {
- result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", xoauth);
-
- if(!result)
- state(conn, IMAP_AUTHENTICATE_FINAL);
- }
-
- Curl_safefree(xoauth);
+ if(!result)
+ state(conn, IMAP_AUTHENTICATE_FINAL);
}
}
+ Curl_safefree(xoauth);
+
return result;
}
/* Create the authorisation message */
result = Curl_sasl_create_plain_message(data, conn->user, conn->passwd,
&plainauth, &len);
+ if(!result && plainauth) {
+ /* Send the message */
+ result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", plainauth);
- /* Send the message */
- if(!result) {
- if(plainauth) {
- result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", plainauth);
-
- if(!result)
- state(conn, POP3_AUTH_FINAL);
- }
-
- Curl_safefree(plainauth);
+ if(!result)
+ state(conn, POP3_AUTH_FINAL);
}
}
+ Curl_safefree(plainauth);
+
return result;
}
/* Create the user message */
result = Curl_sasl_create_login_message(data, conn->user,
&authuser, &len);
+ if(!result && authuser) {
+ /* Send the user */
+ result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", authuser);
- /* Send the user */
- if(!result) {
- if(authuser) {
- result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", authuser);
-
- if(!result)
- state(conn, POP3_AUTH_LOGIN_PASSWD);
- }
-
- Curl_safefree(authuser);
+ if(!result)
+ state(conn, POP3_AUTH_LOGIN_PASSWD);
}
}
+ Curl_safefree(authuser);
+
return result;
}
/* Create the password message */
result = Curl_sasl_create_login_message(data, conn->passwd,
&authpasswd, &len);
+ if(!result && authpasswd) {
+ /* Send the password */
+ result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", authpasswd);
- /* Send the password */
- if(!result) {
- if(authpasswd) {
- result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", authpasswd);
-
- if(!result)
- state(conn, POP3_AUTH_FINAL);
- }
-
- Curl_safefree(authpasswd);
+ if(!result)
+ state(conn, POP3_AUTH_FINAL);
}
}
+ Curl_safefree(authpasswd);
+
return result;
}
result = Curl_sasl_create_ntlm_type1_message(conn->user, conn->passwd,
&conn->ntlm,
&type1msg, &len);
+ if(!result && type1msg) {
+ /* Send the message */
+ result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", type1msg);
- /* Send the message */
- if(!result) {
- if(type1msg) {
- result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", type1msg);
-
- if(!result)
- state(conn, POP3_AUTH_NTLM_TYPE2MSG);
- }
-
- Curl_safefree(type1msg);
+ if(!result)
+ state(conn, POP3_AUTH_NTLM_TYPE2MSG);
}
}
+ Curl_safefree(type1msg);
+
return result;
}
result = Curl_sasl_create_xoauth2_message(conn->data, conn->user,
conn->xoauth2_bearer,
&xoauth, &len);
+ if(!result && xoauth) {
+ /* Send the message */
+ result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", xoauth);
- /* Send the message */
- if(!result) {
- if(xoauth) {
- result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", xoauth);
-
- if(!result)
- state(conn, POP3_AUTH_FINAL);
- }
-
- Curl_safefree(xoauth);
+ if(!result)
+ state(conn, POP3_AUTH_FINAL);
}
}
+ Curl_safefree(xoauth);
+
return result;
}
/* Create the authorisation message */
result = Curl_sasl_create_plain_message(conn->data, conn->user,
conn->passwd, &plainauth, &len);
+ if(!result && plainauth) {
+ /* Send the message */
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", plainauth);
- /* Send the message */
- if(!result) {
- if(plainauth) {
- result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", plainauth);
-
- if(!result)
- state(conn, SMTP_AUTH_FINAL);
- }
-
- Curl_safefree(plainauth);
+ if(!result)
+ state(conn, SMTP_AUTH_FINAL);
}
}
+ Curl_safefree(plainauth);
+
return result;
}
/* Create the user message */
result = Curl_sasl_create_login_message(conn->data, conn->user,
&authuser, &len);
+ if(!result && authuser) {
+ /* Send the user */
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", authuser);
- /* Send the user */
- if(!result) {
- if(authuser) {
- result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", authuser);
-
- if(!result)
- state(conn, SMTP_AUTH_LOGIN_PASSWD);
- }
-
- Curl_safefree(authuser);
+ if(!result)
+ state(conn, SMTP_AUTH_LOGIN_PASSWD);
}
}
+ Curl_safefree(authuser);
+
return result;
}
/* Create the password message */
result = Curl_sasl_create_login_message(conn->data, conn->passwd,
&authpasswd, &len);
+ if(!result && authpasswd) {
+ /* Send the password */
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", authpasswd);
- /* Send the password */
- if(!result) {
- if(authpasswd) {
- result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", authpasswd);
-
- if(!result)
- state(conn, SMTP_AUTH_FINAL);
- }
-
- Curl_safefree(authpasswd);
+ if(!result)
+ state(conn, SMTP_AUTH_FINAL);
}
}
+ Curl_safefree(authpasswd);
+
return result;
}
result = Curl_sasl_create_ntlm_type1_message(conn->user, conn->passwd,
&conn->ntlm,
&type1msg, &len);
+ if(!result && type1msg) {
+ /* Send the message */
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", type1msg);
- /* Send the message */
- if(!result) {
- if(type1msg) {
- result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", type1msg);
-
- if(!result)
- state(conn, SMTP_AUTH_NTLM_TYPE2MSG);
- }
-
- Curl_safefree(type1msg);
+ if(!result)
+ state(conn, SMTP_AUTH_NTLM_TYPE2MSG);
}
}
+ Curl_safefree(type1msg);
+
return result;
}
result = Curl_sasl_create_xoauth2_message(conn->data, conn->user,
conn->xoauth2_bearer,
&xoauth, &len);
+ if(!result && xoauth) {
+ /* Send the message */
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", xoauth);
- /* Send the message */
- if(!result) {
- if(xoauth) {
- result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", xoauth);
-
- if(!result)
- state(conn, SMTP_AUTH_FINAL);
- }
-
- Curl_safefree(xoauth);
+ if(!result)
+ state(conn, SMTP_AUTH_FINAL);
}
}
+ Curl_safefree(xoauth);
+
return result;
}