Commit 505aee79 authored by Jihun Ha's avatar Jihun Ha Committed by Uze Choi

Update for Multi Ownership Transfer condition

The found enrollee's owner ID indicates a same ID of mediator.
However, a list of owned devices managed in mediator's PMD db has
no element for the found enrollee. In that case, MOT will be failed.

For this, ES_OWNERSHIP_IS_NOT_SYNCHRONIZED value is returned, which
guides a user to reset a Enrollee's SVR DB file.

Change-Id: Ia5feaccccfc4cca4a0673d08cbba4d473324e37f
Signed-off-by: default avatarParkhi <h_w.park@samsung.com>
Signed-off-by: default avatarJihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16191Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarUze Choi <uzchoi@samsung.com>
parent f2d3b2d7
......@@ -174,7 +174,10 @@ typedef enum
ES_SECURE_RESOURCE_DISCOVERY_FAILURE,
/**
* Ownership transfer fails because DTLS handshake failure happens
* Ownership transfer fails due to one of unexpected reasons.
* E.g. A packet loss even with retransmission happens during ownership transfer.
* E.g. Mediator's owned status is 'unowned'
* E.g. A user confirmation for random pin-based or certificate-based OT fails
*/
ES_OWNERSHIP_TRANSFER_FAILURE,
......@@ -202,6 +205,14 @@ typedef enum
*/
ES_PRE_CONFIG_PIN_PROVISIONING_FAILURE,
/**
* The found enrollee's owner ID indicates a same ID of mediator.
* However, a list of owned devices managed in mediator's PMD db has no element for the found enrollee.
* That can happen where only mediator is reset without any inform to the enrollee.
* To proceed an ownership transfer to the enrollee, it needs to reset the enrollee's SVR DB for its owner, i.e. the mediator
*/
ES_OWNERSHIP_IS_NOT_SYNCHRONIZED,
/**
* Provisioning fails for some reason.
*/
......
......@@ -493,6 +493,53 @@ namespace OIC
#ifdef MULTIPLE_OWNER
else
{
OCUUIdentity* mediatorDevId = (OCUUIdentity* )OICMalloc(sizeof(OCUUIdentity));
if(!mediatorDevId)
{
OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "provisionOwnership: OICMalloc error return");
res = ESResult::ES_OWNERSHIP_TRANSFER_FAILURE;
return res;
}
if(OC::OCPlatform::getDeviceId(mediatorDevId) != OC_STACK_OK)
{
OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "getDeviceId is failed.");
res = ESResult::ES_OWNERSHIP_TRANSFER_FAILURE;
OICFree(mediatorDevId);
return res;
}
if(!memcmp(m_securedResource->getDevPtr()->doxm->owner.id,
mediatorDevId->id, UUID_IDENTITY_SIZE * sizeof(uint8_t)))
{
OIC_LOG(ERROR, ENROLEE_SECURITY_TAG,
"The found device's owner ID is same as Mediator's ID but Meditor does not know it");
OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Only Mediator would be reset");
res = ESResult::ES_OWNERSHIP_IS_NOT_SYNCHRONIZED;
OICFree(mediatorDevId);
return res;
}
OicSecSubOwner_t* subOwnerList = m_securedResource->getDevPtr()->doxm->subOwners;
while(subOwnerList)
{
if(!memcmp(subOwnerList->uuid.id, mediatorDevId->id,
UUID_IDENTITY_SIZE * sizeof(uint8_t)))
{
OIC_LOG(ERROR, ENROLEE_SECURITY_TAG,
"The found device's subOwner ID is same as Mediator's ID but Meditor does not know it");
OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Only Mediator would be reset");
res = ESResult::ES_OWNERSHIP_IS_NOT_SYNCHRONIZED;
OICFree(mediatorDevId);
return res;
}
subOwnerList = subOwnerList->next;
}
OICFree(mediatorDevId);
res = performMultipleOwnershipTransfer();
if(res != ESResult::ES_OK)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment