summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Gatto <matthias.gatto@outscale.com>2020-07-09 12:04:55 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-12-21 16:28:03 +0100
commit6b27df82695256e6b0c802edff720840c5f1b669 (patch)
tree789ca6dafbe48fd8c8e8cfdb2af88260829e7373
parenteb69797766a36e56c07c2fc4cfe064b60cdeebc0 (diff)
downloadcurl-6b27df82695256e6b0c802edff720840c5f1b669.tar.gz
tool: add AWS HTTP v4 Signature support
Signed-off-by: Matthias Gatto <matthias.gatto@outscale.com>
-rw-r--r--src/tool_cfgable.c2
-rw-r--r--src/tool_cfgable.h1
-rw-r--r--src/tool_getparam.c5
-rw-r--r--src/tool_help.c2
-rw-r--r--src/tool_operate.c2
5 files changed, 12 insertions, 0 deletions
diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c
index 4c06d3557..ff05c295b 100644
--- a/src/tool_cfgable.c
+++ b/src/tool_cfgable.c
@@ -168,6 +168,8 @@ static void free_config_fields(struct OperationConfig *config)
Curl_safefree(config->ftp_account);
Curl_safefree(config->ftp_alternative_to_user);
+
+ Curl_safefree(config->aws_sigv4_provider);
}
void config_free(struct OperationConfig *config)
diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h
index dc1c5e557..ad0d40233 100644
--- a/src/tool_cfgable.h
+++ b/src/tool_cfgable.h
@@ -284,6 +284,7 @@ struct OperationConfig {
0 is valid. default: CURL_HET_DEFAULT. */
bool haproxy_protocol; /* whether to send HAProxy protocol v1 */
bool disallow_username_in_url; /* disallow usernames in URLs */
+ char *aws_sigv4_provider;
struct GlobalConfig *global;
struct OperationConfig *prev;
struct OperationConfig *next; /* Always last in the struct */
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index c57506609..91c278663 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -113,6 +113,7 @@ static const struct LongShort aliases[]= {
{"*t", "proxy-ntlm", ARG_BOOL},
{"*u", "crlf", ARG_BOOL},
{"*v", "stderr", ARG_FILENAME},
+ {"*V", "aws-sigv4", ARG_STRING},
{"*w", "interface", ARG_STRING},
{"*x", "krb", ARG_STRING},
{"*x", "krb4", ARG_STRING},
@@ -803,6 +804,10 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
config->crlf = toggle;
break;
+ case 'V': /* --aws-sigv4 */
+ config->authtype |= CURLAUTH_AWS_SIGV4;
+ GetStr(&config->aws_sigv4_provider, nextarg);
+ break;
case 'v': /* --stderr */
if(strcmp(nextarg, "-")) {
FILE *newfile = fopen(nextarg, FOPEN_WRITETEXT);
diff --git a/src/tool_help.c b/src/tool_help.c
index c78f98fa9..d47e56e71 100644
--- a/src/tool_help.c
+++ b/src/tool_help.c
@@ -817,6 +817,8 @@ static const struct helptxt helptext[] = {
{"-A, --user-agent <name>",
"Send User-Agent <name> to server",
CURLHELP_IMPORTANT | CURLHELP_HTTP},
+ {" --aws-sigv4 <provider1[:provider2]>",
+ "Use HTTP AWS V4 Signature", CURLHELP_HTTP},
{"-v, --verbose",
"Make the operation more talkative",
CURLHELP_IMPORTANT | CURLHELP_VERBOSE},
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 90522e1e9..82a03f829 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1661,6 +1661,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
my_setopt_str(curl, CURLOPT_SSLKEYTYPE, config->key_type);
my_setopt_str(curl, CURLOPT_PROXY_SSLKEYTYPE,
config->proxy_key_type);
+ my_setopt_str(curl, CURLOPT_AWS_SIGV4,
+ config->aws_sigv4_provider);
if(config->insecure_ok) {
my_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);