Skip to content

Commit

Permalink
Use c string instead of byte cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Jan 17, 2024
1 parent e1a91ac commit 9437736
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions source/credentials_provider_profile.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

Expand Down Expand Up @@ -393,8 +391,8 @@ static struct aws_credentials_provider *s_credentials_provider_new_profile_inter
source_profiles_table,
allocator,
3,
aws_hash_byte_cursor_ptr,
(aws_hash_callback_eq_fn *)aws_byte_cursor_eq,
aws_hash_c_string,
aws_hash_callback_c_str_eq,
NULL,
NULL)) {
AWS_LOGF_ERROR(AWS_LS_AUTH_CREDENTIALS_PROVIDER, "hash_table_init failed");
Expand All @@ -408,7 +406,6 @@ static struct aws_credentials_provider *s_credentials_provider_new_profile_inter
AWS_LS_AUTH_CREDENTIALS_PROVIDER, "static: Profile credentials parser failed to resolve profile name");
goto on_finished;
}
struct aws_byte_cursor profile_name_cursor = aws_byte_cursor_from_string(profile_name);

if (options->profile_collection_cached) {
/* Use cached profile collection */
Expand Down Expand Up @@ -461,7 +458,7 @@ static struct aws_credentials_provider *s_credentials_provider_new_profile_inter
bool profile_contains_credentials = profile_contains_access_key || profile_contains_secret_access_key;

struct aws_hash_element *element = NULL;
if (aws_hash_table_find(source_profiles_table, (void *)&profile_name_cursor, &element) == AWS_OP_ERR) {
if (aws_hash_table_find(source_profiles_table, (void *)aws_string_c_str(profile_name), &element) == AWS_OP_ERR) {
AWS_LOGF_ERROR(AWS_LS_AUTH_CREDENTIALS_PROVIDER, "hash_table_find failed");
goto on_finished;
}
Expand All @@ -474,7 +471,7 @@ static struct aws_credentials_provider *s_credentials_provider_new_profile_inter
}
}

aws_hash_table_put(source_profiles_table, (void *)&profile_name_cursor, NULL, 0);
aws_hash_table_put(source_profiles_table, (void *)aws_string_c_str(profile_name), NULL, 0);
if (role_arn_property && (first_profile_in_chain || !profile_contains_credentials)) {
provider = s_create_sts_based_provider(
allocator, role_arn_property, profile, options, merged_profiles, source_profiles_table);
Expand Down

0 comments on commit 9437736

Please sign in to comment.