Skip to content

Commit

Permalink
Merge pull request #403 from awslabs/sync-master-to-develop
Browse files Browse the repository at this point in the history
Sync master to develop
  • Loading branch information
disa6302 authored Sep 5, 2023
2 parents 83dc041 + f7ca82f commit 178109a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMake/Dependencies/libkvspic-CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include(ExternalProject)
# clone repo only
ExternalProject_Add(libkvspic-download
GIT_REPOSITORY https://github.com/awslabs/amazon-kinesis-video-streams-pic.git
GIT_TAG d08be2e16303507d21b4cb376aecda98271687ad
GIT_TAG 57637ea593f4b43c509413a44d993ed08d7f2616
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/kvspic-src"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/kvspic-build"
CMAKE_ARGS
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.6.3)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
include(Utilities)
project(KinesisVideoProducerC VERSION 1.5.0 LANGUAGES C)
project(KinesisVideoProducerC VERSION 1.5.1 LANGUAGES C)

include(GNUInstallDirs)

Expand Down
9 changes: 6 additions & 3 deletions src/source/Common/FileCredentialProvider.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ STATUS readFileCredentials(PFileCredentialProvider pFileCredentialProvider)

CHK(pFileCredentialProvider != NULL && pFileCredentialProvider->credentialsFilepath != NULL, STATUS_NULL_ARG);

// Refresh the credentials by reading from the credentials file if needed
// Only refresh the credentials by reading from the credentials file if needed.
// If we already have credentials and they are not expiring soon, we return successfully here.
currentTime = pFileCredentialProvider->getCurrentTimeFn(pFileCredentialProvider->customData);

CHK(pFileCredentialProvider->pAwsCredentials == NULL ||
currentTime + CREDENTIAL_FILE_READ_GRACE_PERIOD > pFileCredentialProvider->pAwsCredentials->expiration,
retStatus);
Expand Down Expand Up @@ -174,7 +174,10 @@ STATUS readFileCredentials(PFileCredentialProvider pFileCredentialProvider)
sessionTokenLen = sessionToken == NULL ? 0 : (UINT32) STRNLEN(sessionToken, MAX_SESSION_TOKEN_LEN);

if (expirationStr != NULL) {
convertTimestampToEpoch(expirationStr, currentTime / HUNDREDS_OF_NANOS_IN_A_SECOND, &expiration);
// It makes more sense for createDefaultCallbacksProviderWithFileAuth to fail if the credentials are expired
// than for it to succeed and let later service calls fail. Clients who cache credentials in a file will not
// see an error the first time they call createDefaultCallbacksProviderWithFileAuth without this check.
CHK_STATUS(convertTimestampToEpoch(expirationStr, currentTime / HUNDREDS_OF_NANOS_IN_A_SECOND, &expiration));
} else {
expiration = currentTime + MAX_ENFORCED_TOKEN_EXPIRATION_DURATION;
}
Expand Down
4 changes: 3 additions & 1 deletion src/source/Response.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,9 @@ SIZE_T postResponseWriteCallback(PCHAR pBuffer, SIZE_T size, SIZE_T numItems, PV
pNewBuffer = (PCHAR) MEMALLOC(pCurlResponse->callInfo.responseDataLen + dataSize + SIZEOF(CHAR));
if (pNewBuffer != NULL) {
// Copy forward the old
MEMCPY(pNewBuffer, pCurlResponse->callInfo.responseData, pCurlResponse->callInfo.responseDataLen);
if (pCurlResponse->callInfo.responseDataLen > 0) {
MEMCPY(pNewBuffer, pCurlResponse->callInfo.responseData, pCurlResponse->callInfo.responseDataLen);
}

// Append the new data
MEMCPY((PBYTE) pNewBuffer + pCurlResponse->callInfo.responseDataLen, pBuffer, dataSize);
Expand Down
2 changes: 1 addition & 1 deletion tst/AwsCredentialsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ TEST_F(AwsCredentialsTest, TestFileCredentialsWriteWithSession) {
UINT32 length = ARRAY_SIZE(fileContent);

// Store the credentials in a file under the current dir
length = SNPRINTF(fileContent, length, "CREDENTIALS %s 1234567890 %s %s", mAccessKey, mSecretKey, mSessionToken);
length = SNPRINTF(fileContent, length, "CREDENTIALS %s 2200-01-01T00:00:00Z %s %s", mAccessKey, mSecretKey, mSessionToken);
ASSERT_GT(ARRAY_SIZE(fileContent), length);
ASSERT_EQ(STATUS_SUCCESS, writeFile(TEST_FILE_CREDENTIALS_FILE_PATH, FALSE, FALSE, (PBYTE) fileContent, length));

Expand Down
4 changes: 2 additions & 2 deletions tst/FileLoggerFunctionalityTest.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "ProducerTestFixture.h"

// length of time and log level string in log: "2019-11-09 19:11:16.xxxxxx VERBOSE "
#define TIMESTRING_OFFSET 35
// length of time and log level string in log: "2019-11-09 19:11:16.xxx VERBOSE "
#define TIMESTRING_OFFSET 32

namespace com { namespace amazonaws { namespace kinesis { namespace video {

Expand Down

0 comments on commit 178109a

Please sign in to comment.