From b950219fa64b1d7483a3b5432f14e5dcc616ac58 Mon Sep 17 00:00:00 2001 From: Randeep Singh Date: Thu, 6 Oct 2016 20:42:19 +0530 Subject: [PATCH] [IOT-1366] coaps request for secure resource handled pending review comments Change-Id: Iacde7395b7a5da53caff7f175beb3d3e17dd9894 Signed-off-by: Randeep Singh Reviewed-on: https://gerrit.iotivity.org/gerrit/12907 Tested-by: jenkins-iotivity Reviewed-by: Ashwini Kumar --- resource/csdk/security/src/secureresourcemanager.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/resource/csdk/security/src/secureresourcemanager.c b/resource/csdk/security/src/secureresourcemanager.c index 1d6b0f2..694c646 100644 --- a/resource/csdk/security/src/secureresourcemanager.c +++ b/resource/csdk/security/src/secureresourcemanager.c @@ -148,10 +148,11 @@ void SRMRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requ // Copy the subjectID OicUuid_t subjectId = {.id = {0}}; + OicUuid_t nullSubjectId = {.id = {0}}; memcpy(subjectId.id, requestInfo->info.identity.id, sizeof(subjectId.id)); // if subject id is null that means request is sent thru coap. - if (NULL != subjectId.id) + if (memcmp(subjectId.id, nullSubjectId.id, sizeof(subjectId.id)) != 0) { OIC_LOG(INFO, TAG, "request over secure channel"); isRequestOverSecureChannel = true; @@ -189,8 +190,9 @@ void SRMRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requ OCResource *resPtr = FindResourceByUri(newUri); if (NULL != resPtr) { - // check whether request is for secure resource or not - if (((resPtr->resourceProperties) & OC_SECURE)) + // check whether request is for secure resource or not and it should not be a SVR resource + if (((resPtr->resourceProperties) & OC_SECURE) + && (g_policyEngineContext.resourceType == NOT_A_SVR_RESOURCE)) { // if resource is secure and request is over insecure channel if (!isRequestOverSecureChannel) -- 2.7.4