From 92684068b8fe6382315194e4507d0f8de4566d44 Mon Sep 17 00:00:00 2001 From: Vitalii Irkha Date: Tue, 5 Nov 2019 11:42:41 +0200 Subject: [PATCH] Added logging into IsRequestFromDevOwner() API Added logging for CONPRO-1516 issue https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/592/commits/094b5ea90860840b4e0b7026ee6160d8c2866e8c (cherry-picked from 094b5ea90860840b4e0b7026ee6160d8c2866e8c) Change-Id: Ia53c60ec6d70675e5d40f48ff3bf903896fca5dd Signed-off-by: Vitalii Irkha Signed-off-by: Sudipto Bal --- resource/csdk/security/src/policyengine.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/resource/csdk/security/src/policyengine.c b/resource/csdk/security/src/policyengine.c index 67bf641..5f50c3e 100644 --- a/resource/csdk/security/src/policyengine.c +++ b/resource/csdk/security/src/policyengine.c @@ -76,17 +76,20 @@ static bool UuidCmp(OicUuid_t *firstId, OicUuid_t *secondId) // TODO use VERIFY macros to check for null when they are merged. if(NULL == firstId || NULL == secondId) { + OIC_LOG_V(ERROR, TAG, "%s - %s is NULL",__func__, firstId ? "secondId" : "firstId"); return false; } // Check empty uuid string if('\0' == firstId->id[0] || '\0' == secondId->id[0]) { + OIC_LOG_V(ERROR, TAG, "%s - %s is empty",__func__, '\0' == firstId->id[0] ? "firstId" : "secondId"); return false; } for(int i = 0; i < UUID_LENGTH; i++) { if(firstId->id[i] != secondId->id[i]) { + OIC_LOG_V(ERROR, TAG, "%s - Uuids are not equal " ,__func__); return false; } } @@ -132,6 +135,7 @@ static bool IsRequestFromDevOwner(PEContext_t *context) if(NULL == context) { + OIC_LOG_V(ERROR, TAG, "%s: context is NULL", __func__); return retVal; } @@ -147,7 +151,21 @@ static bool IsRequestFromDevOwner(PEContext_t *context) if (doxm) { retVal = UuidCmp(&doxm->owner, &context->subject); + char *strUuid = NULL; + ConvertUuidToStr(&doxm->owner, &strUuid); + OIC_LOG_V(ERROR, TAG, "%s: Owner UUID: %s", __func__, strUuid ? strUuid : "NULL"); + OICFree(strUuid); + + strUuid = NULL; + ConvertUuidToStr(&context->subject, &strUuid); + OIC_LOG_V(ERROR, TAG, "%s: Context subject: %s", __func__, strUuid ? strUuid : "NULL"); + OICFree(strUuid); + } + else + { + OIC_LOG_V(ERROR, TAG, "%s: doxm is NULL", __func__); } + OIC_LOG_V(INFO, TAG, "%s: return val: %s", __func__, retVal ? "True" : "False"); return retVal; } -- 2.7.4