summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2019-04-19 14:26:47 +0100
committerJay Satiro <raysatiro@yahoo.com>2019-08-06 11:38:41 -0400
commit1e08a7925830d7822f911165d9789e5e4f765534 (patch)
treeb3495093a52e85c1a48d3b64bbd89bc0f2458dfd /src
parent7c469fa537397c3b8307c92aa723e3af6d941e95 (diff)
downloadcurl-1e08a7925830d7822f911165d9789e5e4f765534.tar.gz
curl: --sasl-authzid added to support CURLOPT_SASL_AUTHZID from the tool
Ref: https://github.com/curl/curl/issues/3653 Ref: https://github.com/curl/curl/pull/3790 NOTE: This commit was cherry-picked and is part of a series of commits that added the authzid feature for upcoming 7.66.0. The series was temporarily reverted in db8ec1f so that it would not ship in a 7.65.x patch release. Closes https://github.com/curl/curl/pull/4186
Diffstat (limited to 'src')
-rw-r--r--src/tool_cfgable.c1
-rw-r--r--src/tool_cfgable.h1
-rw-r--r--src/tool_getparam.c6
-rw-r--r--src/tool_help.c2
-rw-r--r--src/tool_operate.c5
5 files changed, 14 insertions, 1 deletions
diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c
index 76febc9c9..efa8c50b2 100644
--- a/src/tool_cfgable.c
+++ b/src/tool_cfgable.c
@@ -133,6 +133,7 @@ static void free_config_fields(struct OperationConfig *config)
Curl_safefree(config->krblevel);
Curl_safefree(config->oauth_bearer);
+ Curl_safefree(config->sasl_authzid);
Curl_safefree(config->unix_socket_path);
Curl_safefree(config->writeout);
diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h
index d43f03c40..f6248c20b 100644
--- a/src/tool_cfgable.h
+++ b/src/tool_cfgable.h
@@ -96,6 +96,7 @@ struct OperationConfig {
char *mail_from;
struct curl_slist *mail_rcpt;
char *mail_auth;
+ char *sasl_authzid; /* Authorisation identity (identity to use) */
bool sasl_ir; /* Enable/disable SASL initial response */
bool proxytunnel;
bool ftp_append; /* APPE on ftp */
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index 77a77da70..952e602ed 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -178,7 +178,8 @@ static const struct LongShort aliases[]= {
{"$H", "mail-auth", ARG_STRING},
{"$I", "post303", ARG_BOOL},
{"$J", "metalink", ARG_BOOL},
- {"$K", "sasl-ir", ARG_BOOL},
+ {"$6", "sasl-authzid", ARG_STRING},
+ {"$K", "sasl-ir", ARG_BOOL },
{"$L", "test-event", ARG_BOOL},
{"$M", "unix-socket", ARG_FILENAME},
{"$N", "path-as-is", ARG_BOOL},
@@ -1103,6 +1104,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
#endif
break;
}
+ case '6': /* --sasl-authzid */
+ GetStr(&config->sasl_authzid, nextarg);
+ break;
case 'K': /* --sasl-ir */
config->sasl_ir = toggle;
break;
diff --git a/src/tool_help.c b/src/tool_help.c
index a5b6e7204..86bd692d9 100644
--- a/src/tool_help.c
+++ b/src/tool_help.c
@@ -391,6 +391,8 @@ static const struct helptxt helptext[] = {
"Wait time between retries"},
{" --retry-max-time <seconds>",
"Retry only within this period"},
+ {" --sasl-authzid <identity> ",
+ "Use this identity to act as during SASL PLAIN authentication"},
{" --sasl-ir",
"Enable initial response in SASL authentication"},
{" --service-name <name>",
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 946dc7cca..8d526c328 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1778,6 +1778,10 @@ static CURLcode create_transfers(struct GlobalConfig *global,
if(config->mail_auth)
my_setopt_str(curl, CURLOPT_MAIL_AUTH, config->mail_auth);
+ /* new in 7.66.0 */
+ if(config->sasl_authzid)
+ my_setopt_str(curl, CURLOPT_SASL_AUTHZID, config->sasl_authzid);
+
/* new in 7.31.0 */
if(config->sasl_ir)
my_setopt(curl, CURLOPT_SASL_IR, 1L);
@@ -1801,6 +1805,7 @@ static CURLcode create_transfers(struct GlobalConfig *global,
config->unix_socket_path);
}
}
+
/* new in 7.45.0 */
if(config->proto_default)
my_setopt_str(curl, CURLOPT_DEFAULT_PROTOCOL, config->proto_default);