Skip to content

Commit

Permalink
Committing clang-format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 4, 2024
1 parent 87b9237 commit 5cb2c56
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions src/H5FDs3comms.c
Original file line number Diff line number Diff line change
Expand Up @@ -1847,53 +1847,51 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha
* Purpose:
*
* Get aws credentials from environment variables AWS_ACCESS_KEY_ID,
* AWS_SECRET_ACCESS_KEY, AWS_REGION and AWS_SESSION_TOKEN.
* Values from these environment variables will overrride any values
* AWS_SECRET_ACCESS_KEY, AWS_REGION and AWS_SESSION_TOKEN.
* Values from these environment variables will overrride any values

Check failure on line 1851 in src/H5FDs3comms.c

View workflow job for this annotation

GitHub Actions / Check for spelling errors

overrride ==> override
* for corresponding variables loaded from credentials and configuration
* files.
*
* Values for AWS_PROFILE and AWS_MAX_ATTEMPTS are not currently obtained.
*
* Return: SUCCEED/FAIL
* Return: SUCCEED/FAIL
*
*/
static herr_t
H5FD__s3comms_load_aws_creds_from_env(char *key_id, char *secret_access_key, char *aws_region)
{
herr_t ret_value = SUCCEED;
char *key_id_env=NULL;
char *secret_access_key_env=NULL;
char *aws_region_env=NULL;
{
herr_t ret_value = SUCCEED;
char *key_id_env = NULL;
char *secret_access_key_env = NULL;
char *aws_region_env = NULL;

FUNC_ENTER_PACKAGE

/* AWS_ACCESS_KEY_ID values are typically 16 or 20 characters, with up to 128 allowed.
* Difference in size between the one from the environment and one in cred files
* requires some special handling.
* requires some special handling.
*/
key_id_env=getenv("AWS_ACCESS_KEY_ID");
key_id_env = getenv("AWS_ACCESS_KEY_ID");
if (key_id_env != NULL && key_id_env[0] != '\0') {
if (strlen(key_id) == 0 || strncmp(key_id, key_id_env, strlen(key_id) != 0))
strncpy(key_id, key_id_env, strlen(key_id_env));
key_id[strlen(key_id_env)] = '\0';
key_id[strlen(key_id_env)] = '\0';
}

/* AWS_SECRET_ACCESS_KEY values are 40 characters */
secret_access_key_env=getenv("AWS_SECRET_ACCESS_KEY");
if (secret_access_key_env != NULL && secret_access_key_env[0] != '\0') {
/* AWS_SECRET_ACCESS_KEY values are 40 characters */
secret_access_key_env = getenv("AWS_SECRET_ACCESS_KEY");
if (secret_access_key_env != NULL && secret_access_key_env[0] != '\0') {
if (strlen(secret_access_key) == 0 ||
strncmp(secret_access_key, secret_access_key_env,
strlen(secret_access_key)) != 0) {
strncmp(secret_access_key, secret_access_key_env, strlen(secret_access_key)) != 0) {
strncpy(secret_access_key, secret_access_key_env, strlen(secret_access_key_env));
secret_access_key[strlen(secret_access_key_env)] = '\0';
}
}

/* AWS_REGION values are 9 - ~12 characters */
aws_region_env=getenv("AWS_REGION");
if (aws_region_env != NULL && aws_region_env[0] != '\0') {
if (strlen(aws_region) == 0 ||
strncmp(aws_region, aws_region_env, strlen(aws_region)) != 0) {
/* AWS_REGION values are 9 - ~12 characters */
aws_region_env = getenv("AWS_REGION");
if (aws_region_env != NULL && aws_region_env[0] != '\0') {
if (strlen(aws_region) == 0 || strncmp(aws_region, aws_region_env, strlen(aws_region)) != 0) {
strncpy(aws_region, aws_region_env, strlen(aws_region_env));
aws_region[strlen(aws_region_env)] = '\0';
}
Expand Down Expand Up @@ -1980,7 +1978,7 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char *
} /* end if credential file opened */

/* Check for credentials in environment variables. Environment variables will override
* credentials from credentials/config files and just load them if there were none in
* credentials from credentials/config files and just load them if there were none in
* the files. */
ret_value = H5FD__s3comms_load_aws_creds_from_env(key_id_out, secret_access_key_out, aws_region_out);

Expand Down

0 comments on commit 5cb2c56

Please sign in to comment.