From a14d72ca2fec5d4eb5a043936e4f7ce08015c177 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Wed, 17 Apr 2019 23:47:51 +0100 Subject: sasl: Implement SASL authorisation identity via CURLOPT_SASL_AUTHZID Added the ability for the calling program to specify the authorisation identity (authzid), the identity to act as, in addition to the authentication identity (authcid) and password when using SASL PLAIN authentication. Fixed #3653 Closes #3790 --- lib/url.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/url.c') diff --git a/lib/url.c b/lib/url.c index 16d910b71..5b4b00eac 100644 --- a/lib/url.c +++ b/lib/url.c @@ -713,6 +713,7 @@ static void conn_free(struct connectdata *conn) Curl_safefree(conn->user); Curl_safefree(conn->passwd); Curl_safefree(conn->oauth_bearer); + Curl_safefree(conn->sasl_authzid); Curl_safefree(conn->options); Curl_safefree(conn->http_proxy.user); Curl_safefree(conn->socks_proxy.user); @@ -3461,6 +3462,14 @@ static CURLcode create_conn(struct Curl_easy *data, } } + if(data->set.str[STRING_SASL_AUTHZID]) { + conn->sasl_authzid = strdup(data->set.str[STRING_SASL_AUTHZID]); + if(!conn->sasl_authzid) { + result = CURLE_OUT_OF_MEMORY; + goto out; + } + } + #ifdef USE_UNIX_SOCKETS if(data->set.str[STRING_UNIX_SOCKET_PATH]) { conn->unix_domain_socket = strdup(data->set.str[STRING_UNIX_SOCKET_PATH]); -- cgit v1.2.3