From: saurabh.s9 Date: Thu, 25 Aug 2016 12:20:51 +0000 (+0530) Subject: [IOT-1226] Updating code for reset case without client knowledge X-Git-Tag: 1.2.0+RC1~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=63a93e6db3270d8a983f31978510f12ecd6fd88e;p=platform%2Fupstream%2Fiotivity.git [IOT-1226] Updating code for reset case without client knowledge Change-Id: I24af255c499dd6502d5a4186c4bad7a2ede7225a Signed-off-by: saurabh.s9 Reviewed-on: https://gerrit.iotivity.org/gerrit/10919 Tested-by: jenkins-iotivity Reviewed-by: Heewon Park Reviewed-by: Jihun Ha Reviewed-by: Randeep Singh --- diff --git a/resource/csdk/security/provisioning/src/ocprovisioningmanager.c b/resource/csdk/security/provisioning/src/ocprovisioningmanager.c old mode 100755 new mode 100644 index 277e7f1..fdf9010 --- a/resource/csdk/security/provisioning/src/ocprovisioningmanager.c +++ b/resource/csdk/security/provisioning/src/ocprovisioningmanager.c @@ -933,6 +933,36 @@ OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime, return res; } + // Code to compare devices in unowned list and deviceid from DB + // (In case of hard reset of the device) + OCProvisionDev_t* pUnownedList = unownedDevice; + while (pUnownedList && uuidList) + { + OCUuidList_t *tmp1 = NULL,*tmp2=NULL; + LL_FOREACH_SAFE(uuidList, tmp1, tmp2) + { + if(0 == memcmp(tmp1->dev.id, pUnownedList->doxm->deviceID.id, + sizeof(pUnownedList->doxm->deviceID.id))) + { + OIC_LOG_V(INFO, TAG, "OCGetDevInfoFromNetwork : \ + Removing device id = %s in PDM and dat.", pUnownedList->doxm->deviceID.id); + if (OC_STACK_OK != PDMDeleteDevice(&pUnownedList->doxm->deviceID)) + { + OIC_LOG(ERROR, TAG, "OCGetDevInfoFromNetwork : \ + Failed to remove device in PDM."); + } + //remove the cred entry from dat file + if (OC_STACK_OK != RemoveDeviceInfoFromLocal(pUnownedList)) + { + OIC_LOG(ERROR, TAG, "OCGetDevInfoFromNetwork : \ + Failed to remove cred entry device in dat file."); + } + LL_DELETE(uuidList, tmp1); + OICFree(tmp1); + } + } + pUnownedList = pUnownedList->next; + } // Code to compare devices in owned list and deviceid from DB. OCProvisionDev_t* pCurDev = ownedDevice; size_t deleteCnt = 0;