Update snapshot(2017-10-11)
[platform/upstream/iotivity.git] / resource / csdk / security / src / doxmresource.c
index 43aeb54..6ee4b26 100644 (file)
@@ -116,6 +116,7 @@ static OicSecDoxm_t gDefaultDoxm =
 static uint16_t gConfirmMsgId = 0;
 static ConfirmState_t gConfirmState = CONFIRM_STATE_READY;
 
+static uint8_t gEmptyUuid[UUID_LENGTH] = {0};
 
 /**
  * This method is internal method.
@@ -2049,8 +2050,9 @@ OCStackResult SetDoxmDeviceID(const OicUuid_t *deviceID)
 
 #ifdef __WITH_DTLS__
     //for normal device.
-    if (true == gDoxm->owned &&
-        memcmp(gDoxm->deviceID.id, gDoxm->owner.id, sizeof(gDoxm->owner.id)) != 0)
+    if (true == gDoxm->owned
+            && memcmp(gEmptyUuid, gDoxm->owner.id, sizeof(gDoxm->owner.id)) != 0
+            && memcmp(gDoxm->deviceID.id, gDoxm->owner.id, sizeof(gDoxm->owner.id)) != 0)
     {
         OIC_LOG(ERROR, TAG, "This device owned by owner's device.");
         OIC_LOG(ERROR, TAG, "Device UUID cannot be changed to guarantee the reliability of the connection.");
@@ -2177,7 +2179,7 @@ OCStackResult SetMOTStatus(bool enable)
     bool isDeallocateRequired = false;
 
     VERIFY_NON_NULL(TAG, gDoxm, ERROR);
-    
+
     if (NULL == gDoxm->mom && !enable)
     {
         OIC_LOG_V(DEBUG, TAG, "Out %s", __func__);