CONPRO-1467: Improve Reset
[platform/upstream/iotivity.git] / resource / csdk / security / src / doxmresource.c
index 6d35780..d8b4506 100644 (file)
@@ -1142,14 +1142,12 @@ void * WaitConfirm(OCEntityHandlerRequest * ehRequest)
         gConfirmState = CONFIRM_STATE_ACCEPTED;
         HandleDoxmPostRequest(ehRequest);
         g_isConfirmResult = false;
-        return NULL;
     }
     else
     {
         gConfirmState = CONFIRM_STATE_DENIED;
         HandleDoxmPostRequest(ehRequest);
         g_isConfirmResult = false;
-        return NULL;
     }
 
     DestroyEntityHandlerRequest(ehRequest);
@@ -1229,14 +1227,8 @@ static OCEntityHandlerRequest *CopyRequest(OCEntityHandlerRequest *entityHandler
     copyOfRequest->numRcvdVendorSpecificHeaderOptions = 0;
     copyOfRequest->rcvdVendorSpecificHeaderOptions = NULL;
 
-    if (copyOfRequest)
-    {
-        OIC_LOG(INFO, TAG, "Copied client request");
-    }
-    else
-    {
-        OIC_LOG(ERROR, TAG, "Error copying client request");
-    }
+    OIC_LOG(INFO, TAG, "Copied client request");
+
     return copyOfRequest;
 }
 #endif // defined(__WITH_DTLS__) || defined (__WITH_TLS__)
@@ -1310,6 +1302,13 @@ static OCEntityHandlerResult HandleDoxmPostRequest(OCEntityHandlerRequest * ehRe
                     ehRet = OC_EH_NOT_ACCEPTABLE;
                     goto exit;
                 }
+
+                if(0 != memcmp(&gDoxm->owner.id, &newDoxm->owner.id, sizeof(gDoxm->owner.id)))
+                {
+                    OIC_LOG(ERROR, TAG, "Not acceptable request for owned property");
+                    ehRet = OC_EH_NOT_ACCEPTABLE;
+                }
+
                 //Update gDoxm based on newDoxm
                 updateWriteableProperty(newDoxm, gDoxm);
 
@@ -1779,8 +1778,7 @@ exit:
                     InvokeOtmEventHandler(ehRequest->devAddr.addr, ehRequest->devAddr.port,
                                           NULL, OIC_OTM_ERROR);
 #endif
-                    RestoreDoxmToInitState();
-                    RestorePstatToInitState();
+                    ResetSecureResourceInPS();
                     OIC_LOG(WARNING, TAG, "DOXM will be reverted.");
                 }
             }