Fix a wrong return if an user does not set a MOT configuration
authorJihun Ha <jihun.ha@samsung.com>
Fri, 17 Mar 2017 08:20:44 +0000 (17:20 +0900)
committerUze Choi <uzchoi@samsung.com>
Mon, 20 Mar 2017 02:16:46 +0000 (02:16 +0000)
If an user does not set any MOT configuration and ownership transfer is
successfully done, then a result should be ES_OK.
If ESOwnershipTransferData->getMOTMethod() is OIC_OXM_COUNT, it means user
does not set the configuration.

Change-Id: I055beed8e893ae0754a4f5ea467cbe99f649ca4d
Signed-off-by: Jihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/17973
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/easy-setup/mediator/richsdk/inc/ESRichCommon.h
service/easy-setup/mediator/richsdk/src/EnrolleeSecurity.cpp

index c0c1172..d346875 100755 (executable)
@@ -1013,7 +1013,7 @@ namespace OIC
         public:
 #ifdef __WITH_DTLS__
             ESOwnershipTransferData() :
-                m_MOTMethod(OIC_JUST_WORKS), m_preconfiguredPin("")
+                m_MOTMethod(OIC_OXM_COUNT), m_preconfiguredPin("")
             {
             }
 
index b553e93..4bd819d 100755 (executable)
@@ -429,6 +429,7 @@ namespace OIC
 
         ESResult EnrolleeSecurity::requestEnableMOTMode()
         {
+            OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "requestEnableMOTMode IN");
             ESResult res = ESResult:: ES_ERROR;
 
             OC::ResultCallBack changeMOTMethodCB = std::bind(
@@ -460,6 +461,7 @@ namespace OIC
 
         ESResult EnrolleeSecurity::provisionMOTConfig(const ESOwnershipTransferData& MOTData)
         {
+            OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "provisionMOTConfig IN");
             ESResult res = ESResult:: ES_ERROR;
 
             if(!m_securedResource->isMOTEnabled())
@@ -910,7 +912,8 @@ namespace OIC
                         return res;
                     }
 #ifdef MULTIPLE_OWNER
-                    if( m_securedResource->isMOTSupported())
+                    if( m_securedResource->isMOTSupported() &&
+                        ownershipTransferData.getMOTMethod() != OIC_OXM_COUNT)
                     {
                         res = provisionMOTConfig(ownershipTransferData);
                     }