From: Parkhi Date: Tue, 11 Oct 2016 07:12:18 +0000 (+0900) Subject: Updated Easysetup Security logic. X-Git-Tag: 1.2.0+RC4~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f139f9337d18d73aacc7c45fb87017758fefb83b;p=platform%2Fupstream%2Fiotivity.git Updated Easysetup Security logic. - EnrolleeSecure resource not to re-created during previous request is processed for every security provisioning request to get callback from security-logic Change-Id: I905b1cf708db68583a95bd9cad299212fa00ec84 Signed-off-by: Parkhi Reviewed-on: https://gerrit.iotivity.org/gerrit/13077 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi (cherry picked from commit 6bc9e3388d3cafb0af33e785b3650af9f94ff7d1) Reviewed-on: https://gerrit.iotivity.org/gerrit/13203 Reviewed-by: Madan Lanka --- diff --git a/service/easy-setup/mediator/richsdk/src/RemoteEnrollee.cpp b/service/easy-setup/mediator/richsdk/src/RemoteEnrollee.cpp index 6fec143ed..58661d078 100755 --- a/service/easy-setup/mediator/richsdk/src/RemoteEnrollee.cpp +++ b/service/easy-setup/mediator/richsdk/src/RemoteEnrollee.cpp @@ -220,13 +220,17 @@ namespace OIC this, std::placeholders::_1); //TODO : DBPath is passed empty as of now. Need to take dbpath from application. - m_enrolleeSecurity = std::make_shared (m_ocResource, ""); + if(!m_enrolleeSecurity.get()) + { + m_enrolleeSecurity = std::make_shared (m_ocResource, ""); + } res = m_enrolleeSecurity->provisionOwnership(); std::shared_ptr< SecProvisioningStatus > securityProvisioningStatus = std::make_shared< SecProvisioningStatus >(m_enrolleeSecurity->getUUID(), res); m_securityProvStatusCb(securityProvisioningStatus); + m_enrolleeSecurity.reset(); #else OIC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Mediator is unsecured."); if(!callback) @@ -375,11 +379,15 @@ namespace OIC if(!(cloudProp.getCloudID().empty() && cloudProp.getCredID() <= 0)) { ESResult res = ESResult::ES_ERROR; - m_enrolleeSecurity = std::make_shared (m_ocResource, ""); + if(!m_enrolleeSecurity.get()) + { + m_enrolleeSecurity = std::make_shared (m_ocResource, ""); + } + res = m_enrolleeSecurity->provisionSecurityForCloudServer(cloudProp.getCloudID(), cloudProp.getCredID()); - + m_enrolleeSecurity.reset(); if(res != ESResult::ES_OK) { m_cloudResource = nullptr;