Microsoft Azure IoTHub client libraries
Dependents: sht15_remote_monitoring RobotArmDemo iothub_client_sample_amqp f767zi_mqtt ... more
This library implements the Microsoft Azure IoTHub client library. The code is replicated from https://github.com/Azure/azure-iot-sdks
Diff: iothub_client_authorization.c
- Revision:
- 92:97148cf9aa2a
- Parent:
- 89:a2ed767a532e
- Child:
- 93:7c0bbb86b167
diff -r bbf806070c5f -r 97148cf9aa2a iothub_client_authorization.c --- a/iothub_client_authorization.c Thu Jul 12 18:09:13 2018 -0700 +++ b/iothub_client_authorization.c Tue Sep 11 11:13:11 2018 -0700 @@ -6,7 +6,7 @@ #include "azure_c_shared_utility/macro_utils.h" #include "azure_c_shared_utility/umock_c_prod.h" #include "azure_c_shared_utility/crt_abstractions.h" -#include "azure_c_shared_utility/agenttime.h" +#include "azure_c_shared_utility/agenttime.h" #include "azure_c_shared_utility/xlogging.h" #include "azure_c_shared_utility/strings.h" #include "azure_c_shared_utility/sastoken.h" @@ -333,7 +333,7 @@ LogError("failure getting seconds from epoch"); result = NULL; } - else + else { memset(&dev_auth_cred, 0, sizeof(DEVICE_AUTH_CREDENTIAL_INFO)); size_t expiry_time = sec_since_epoch+expiry_time_relative_seconds; @@ -400,7 +400,7 @@ LogError("failure getting seconds from epoch"); result = NULL; } - else + else { /* Codes_SRS_IoTHub_Authorization_07_011: [ IoTHubClient_Auth_Get_ConnString shall call SASToken_CreateString to construct the sas token. ] */ size_t expiry_time = sec_since_epoch+expiry_time_relative_seconds; @@ -539,7 +539,17 @@ #ifdef USE_EDGE_MODULES char* IoTHubClient_Auth_Get_TrustBundle(IOTHUB_AUTHORIZATION_HANDLE handle) { - return iothub_device_auth_get_trust_bundle(handle->device_auth_handle); + char* result; + if (handle == NULL) + { + LogError("Security Handle is NULL"); + result = NULL; + } + else + { + result = iothub_device_auth_get_trust_bundle(handle->device_auth_handle); + } + return result; } #endif