summaryrefslogtreecommitdiffstats
path: root/test/s3comms.c
diff options
context:
space:
mode:
authorJan-Willem Blokland <Jan-Willem.Blokland@Shell.com>2023-07-14 20:15:11 (GMT)
committerGitHub <noreply@github.com>2023-07-14 20:15:11 (GMT)
commit305ac8886566968ae58ba771e0ae2ba6434ac9f0 (patch)
treef298531f43ad0d0a22ae81c4fb7f4eb2fac4bd33 /test/s3comms.c
parentf21cd485a7eea5c6ec6b5dac0ccdd2118559d969 (diff)
downloadhdf5-305ac8886566968ae58ba771e0ae2ba6434ac9f0.zip
hdf5-305ac8886566968ae58ba771e0ae2ba6434ac9f0.tar.gz
hdf5-305ac8886566968ae58ba771e0ae2ba6434ac9f0.tar.bz2
ROS3: (feature) Temporary security credentials (#3030)
- Implemented support for AWS temporary security credentials. For this kind of credentials also a session/security token should be included in the request by adding the x-amz-security-token header. Co-authored-by: Larry Knox <lrknox@hdfgroup.org> Co-authored-by: Jordan Henderson <jhenderson@hdfgroup.org> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'test/s3comms.c')
-rw-r--r--test/s3comms.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/test/s3comms.c b/test/s3comms.c
index 07dcce9..ea32769 100644
--- a/test/s3comms.c
+++ b/test/s3comms.c
@@ -348,6 +348,7 @@ static int s3_test_credentials_loaded = 0;
static char s3_test_aws_region[16] = "";
static char s3_test_aws_access_key_id[64] = "";
static char s3_test_aws_secret_access_key[128] = "";
+static char s3_test_aws_security_token[1024] = "";
static char s3_test_bucket_url[S3_TEST_MAX_URL_SIZE] = "";
static hbool_t s3_test_bucket_defined = FALSE;
@@ -1722,7 +1723,7 @@ test_s3r_get_filesize(void)
JSVERIFY(0, H5FD_s3comms_s3r_get_filesize(NULL), "filesize of the null handle should be 0")
- handle = H5FD_s3comms_s3r_open(url_raven, NULL, NULL, NULL);
+ handle = H5FD_s3comms_s3r_open(url_raven, NULL, NULL, NULL, NULL);
FAIL_IF(handle == NULL)
JSVERIFY(6464, H5FD_s3comms_s3r_get_filesize(handle), NULL)
@@ -1830,14 +1831,14 @@ test_s3r_open(void)
/* attempt anonymously
*/
- handle = H5FD_s3comms_s3r_open(url_missing, NULL, NULL, NULL);
+ handle = H5FD_s3comms_s3r_open(url_missing, NULL, NULL, NULL, NULL);
FAIL_IF(handle != NULL);
/* attempt with authentication
*/
- handle =
- H5FD_s3comms_s3r_open(url_missing, (const char *)s3_test_aws_region,
- (const char *)s3_test_aws_access_key_id, (const unsigned char *)signing_key);
+ handle = H5FD_s3comms_s3r_open(
+ url_missing, (const char *)s3_test_aws_region, (const char *)s3_test_aws_access_key_id,
+ (const unsigned char *)signing_key, (const char *)s3_test_aws_security_token);
FAIL_IF(handle != NULL);
/*************************
@@ -1846,7 +1847,7 @@ test_s3r_open(void)
#if S3_TEST_RUN_TIMEOUT
printf("Opening on inactive port may hang for a minute; waiting for timeout\n");
- handle = H5FD_s3comms_s3r_open(url_raven_badport, NULL, NULL, NULL);
+ handle = H5FD_s3comms_s3r_open(url_raven_badport, NULL, NULL, NULL, NULL);
FAIL_IF(handle != NULL);
#endif
@@ -1856,20 +1857,21 @@ test_s3r_open(void)
/* anonymous access on restricted file
*/
- handle = H5FD_s3comms_s3r_open(url_shakespeare, NULL, NULL, NULL);
+ handle = H5FD_s3comms_s3r_open(url_shakespeare, NULL, NULL, NULL, NULL);
FAIL_IF(handle != NULL);
/* passed in a bad ID
*/
- handle = H5FD_s3comms_s3r_open(url_shakespeare, (const char *)s3_test_aws_region, "I_MADE_UP_MY_ID",
- (const unsigned char *)signing_key);
+ handle =
+ H5FD_s3comms_s3r_open(url_shakespeare, (const char *)s3_test_aws_region, "I_MADE_UP_MY_ID",
+ (const unsigned char *)signing_key, (const char *)s3_test_aws_security_token);
FAIL_IF(handle != NULL);
/* using an invalid signing key
*/
- handle =
- H5FD_s3comms_s3r_open(url_shakespeare, (const char *)s3_test_aws_region,
- (const char *)s3_test_aws_access_key_id, (const unsigned char *)EMPTY_SHA256);
+ handle = H5FD_s3comms_s3r_open(
+ url_shakespeare, (const char *)s3_test_aws_region, (const char *)s3_test_aws_access_key_id,
+ (const unsigned char *)EMPTY_SHA256, (const char *)s3_test_aws_security_token);
FAIL_IF(handle != NULL);
/*******************************
@@ -1878,7 +1880,7 @@ test_s3r_open(void)
/* anonymous
*/
- handle = H5FD_s3comms_s3r_open(url_raven, NULL, NULL, NULL);
+ handle = H5FD_s3comms_s3r_open(url_raven, NULL, NULL, NULL, NULL);
FAIL_IF(handle == NULL);
JSVERIFY(6464, H5FD_s3comms_s3r_get_filesize(handle), "did not get expected filesize")
JSVERIFY(SUCCEED, H5FD_s3comms_s3r_close(handle), "unable to close file")
@@ -1886,9 +1888,9 @@ test_s3r_open(void)
/* using authentication on anonymously-accessible file?
*/
- handle =
- H5FD_s3comms_s3r_open(url_raven, (const char *)s3_test_aws_region,
- (const char *)s3_test_aws_access_key_id, (const unsigned char *)signing_key);
+ handle = H5FD_s3comms_s3r_open(
+ url_raven, (const char *)s3_test_aws_region, (const char *)s3_test_aws_access_key_id,
+ (const unsigned char *)signing_key, (const char *)s3_test_aws_security_token);
FAIL_IF(handle == NULL);
JSVERIFY(6464, H5FD_s3comms_s3r_get_filesize(handle), NULL)
JSVERIFY(SUCCEED, H5FD_s3comms_s3r_close(handle), "unable to close file")
@@ -1896,9 +1898,9 @@ test_s3r_open(void)
/* authenticating
*/
- handle =
- H5FD_s3comms_s3r_open(url_shakespeare, (const char *)s3_test_aws_region,
- (const char *)s3_test_aws_access_key_id, (const unsigned char *)signing_key);
+ handle = H5FD_s3comms_s3r_open(
+ url_shakespeare, (const char *)s3_test_aws_region, (const char *)s3_test_aws_access_key_id,
+ (const unsigned char *)signing_key, (const char *)s3_test_aws_security_token);
FAIL_IF(handle == NULL);
JSVERIFY(5458199, H5FD_s3comms_s3r_get_filesize(handle), NULL)
JSVERIFY(SUCCEED, H5FD_s3comms_s3r_close(handle), "unable to close file")
@@ -1984,7 +1986,7 @@ test_s3r_read(void)
/* open file
*/
- handle = H5FD_s3comms_s3r_open(url_raven, NULL, NULL, NULL);
+ handle = H5FD_s3comms_s3r_open(url_raven, NULL, NULL, NULL, NULL);
FAIL_IF(handle == NULL)
JSVERIFY(6464, H5FD_s3comms_s3r_get_filesize(handle), NULL)