Skip to content

Commit 178109a

Browse files
authored
Merge pull request #403 from awslabs/sync-master-to-develop
Sync master to develop
2 parents 83dc041 + f7ca82f commit 178109a

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

CMake/Dependencies/libkvspic-CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ include(ExternalProject)
77
# clone repo only
88
ExternalProject_Add(libkvspic-download
99
GIT_REPOSITORY https://github.com/awslabs/amazon-kinesis-video-streams-pic.git
10-
GIT_TAG d08be2e16303507d21b4cb376aecda98271687ad
10+
GIT_TAG 57637ea593f4b43c509413a44d993ed08d7f2616
1111
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/kvspic-src"
1212
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/kvspic-build"
1313
CMAKE_ARGS

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.6.3)
22
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
33
include(Utilities)
4-
project(KinesisVideoProducerC VERSION 1.5.0 LANGUAGES C)
4+
project(KinesisVideoProducerC VERSION 1.5.1 LANGUAGES C)
55

66
include(GNUInstallDirs)
77

src/source/Common/FileCredentialProvider.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ STATUS readFileCredentials(PFileCredentialProvider pFileCredentialProvider)
121121

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

124-
// Refresh the credentials by reading from the credentials file if needed
124+
// Only refresh the credentials by reading from the credentials file if needed.
125+
// If we already have credentials and they are not expiring soon, we return successfully here.
125126
currentTime = pFileCredentialProvider->getCurrentTimeFn(pFileCredentialProvider->customData);
126-
127127
CHK(pFileCredentialProvider->pAwsCredentials == NULL ||
128128
currentTime + CREDENTIAL_FILE_READ_GRACE_PERIOD > pFileCredentialProvider->pAwsCredentials->expiration,
129129
retStatus);
@@ -174,7 +174,10 @@ STATUS readFileCredentials(PFileCredentialProvider pFileCredentialProvider)
174174
sessionTokenLen = sessionToken == NULL ? 0 : (UINT32) STRNLEN(sessionToken, MAX_SESSION_TOKEN_LEN);
175175

176176
if (expirationStr != NULL) {
177-
convertTimestampToEpoch(expirationStr, currentTime / HUNDREDS_OF_NANOS_IN_A_SECOND, &expiration);
177+
// It makes more sense for createDefaultCallbacksProviderWithFileAuth to fail if the credentials are expired
178+
// than for it to succeed and let later service calls fail. Clients who cache credentials in a file will not
179+
// see an error the first time they call createDefaultCallbacksProviderWithFileAuth without this check.
180+
CHK_STATUS(convertTimestampToEpoch(expirationStr, currentTime / HUNDREDS_OF_NANOS_IN_A_SECOND, &expiration));
178181
} else {
179182
expiration = currentTime + MAX_ENFORCED_TOKEN_EXPIRATION_DURATION;
180183
}

src/source/Response.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,9 @@ SIZE_T postResponseWriteCallback(PCHAR pBuffer, SIZE_T size, SIZE_T numItems, PV
548548
pNewBuffer = (PCHAR) MEMALLOC(pCurlResponse->callInfo.responseDataLen + dataSize + SIZEOF(CHAR));
549549
if (pNewBuffer != NULL) {
550550
// Copy forward the old
551-
MEMCPY(pNewBuffer, pCurlResponse->callInfo.responseData, pCurlResponse->callInfo.responseDataLen);
551+
if (pCurlResponse->callInfo.responseDataLen > 0) {
552+
MEMCPY(pNewBuffer, pCurlResponse->callInfo.responseData, pCurlResponse->callInfo.responseDataLen);
553+
}
552554

553555
// Append the new data
554556
MEMCPY((PBYTE) pNewBuffer + pCurlResponse->callInfo.responseDataLen, pBuffer, dataSize);

tst/AwsCredentialsTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ TEST_F(AwsCredentialsTest, TestFileCredentialsWriteWithSession) {
253253
UINT32 length = ARRAY_SIZE(fileContent);
254254

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

tst/FileLoggerFunctionalityTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "ProducerTestFixture.h"
22

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

66
namespace com { namespace amazonaws { namespace kinesis { namespace video {
77

0 commit comments

Comments
 (0)