Commit af5a8d01 authored by Jongmin Choi's avatar Jongmin Choi Committed by Randeep

[IOT-1395] Fix for rowneruuid update

[IOT-1395] Fix for rowneruuid update for CTT testing

Patch #1-2: rowneruuid update enabled
Patch #4: Logic modified

Change-Id: I2d6a53c1868e59ea112def5c45ed869b2b6d86da
Signed-off-by: default avatarJongmin Choi <jminl.choi@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/12807Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Nathan Heldt-Sheller's avatarNathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
Reviewed-by: Randeep's avatarRandeep Singh <randeep.s@samsung.com>
(cherry picked from commit dd82e656)
Reviewed-on: https://gerrit.iotivity.org/gerrit/12997
parent 9e03b6e4
......@@ -58,7 +58,7 @@ static const uint8_t ACL_RESOURCE_MAP_SIZE = 3;
// CborSize is the default cbor payload size being used.
static const uint16_t CBOR_SIZE = 2048;
static const uint16_t CBOR_SIZE = 2048*8;
static OicSecAcl_t *gAcl = NULL;
static OCResourceHandle gAclHandle = NULL;
......@@ -1774,6 +1774,7 @@ static OCEntityHandlerResult HandleACLPostRequest(const OCEntityHandlerRequest *
}
}
}
memcpy(&(gAcl->rownerID), &(newAcl->rownerID), sizeof(OicUuid_t));
DeleteACLList(newAcl);
......@@ -1781,6 +1782,7 @@ static OCEntityHandlerResult HandleACLPostRequest(const OCEntityHandlerRequest *
{
size_t size = 0;
uint8_t *cborPayload = NULL;
if (OC_STACK_OK == AclToCBORPayload(gAcl, &cborPayload, &size))
{
if (UpdateSecureResourceInPS(OIC_JSON_ACL_NAME, cborPayload, size) == OC_STACK_OK)
......
......@@ -948,6 +948,10 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
VERIFY_SUCCESS(TAG, ret == OC_STACK_OK, ERROR);
OICFree(stRowner);
}
else if (NULL != gCred)
{
memcpy(&(headCred->rownerID), &(gCred->rownerID), sizeof(OicUuid_t));
}
OICFree(tagName);
}
if (cbor_value_is_valid(&CredRootMap))
......@@ -1284,6 +1288,7 @@ OCStackResult AddCredential(OicSecCred_t * newCred)
{
OCStackResult ret = OC_STACK_ERROR;
OicSecCred_t * temp = NULL;
bool validFlag = true;
VERIFY_SUCCESS(TAG, NULL != newCred, ERROR);
//Assigning credId to the newCred
......@@ -1299,20 +1304,26 @@ OCStackResult AddCredential(OicSecCred_t * newCred)
"new credential's ID will be replaced.", temp->credId);
newCred->credId = temp->credId;
ret = OC_STACK_OK;
goto exit;
validFlag = false;
break;
}
if (CRED_CMP_ERROR == cmpRes)
{
OIC_LOG_V(WARNING, TAG, "Credential skipped : %d", cmpRes);
ret = OC_STACK_ERROR;
goto exit;
validFlag = false;
break;
}
}
//Append the new Cred to existing list
LL_APPEND(gCred, newCred);
//Append the new Cred to existing list if new Cred is valid
if (validFlag)
{
LL_APPEND(gCred, newCred);
}
memcpy(&(gCred->rownerID), &(newCred->rownerID), sizeof(OicUuid_t));
if (UpdatePersistentStorage(gCred))
{
ret = OC_STACK_OK;
......
......@@ -390,11 +390,6 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload, const siz
VERIFY_SUCCESS(TAG, OC_STACK_OK == ret, ERROR);
OICFree(strUuid );
strUuid = NULL;
if (roParsed)
{
*roParsed = true;
}
}
else
{
......@@ -607,6 +602,7 @@ static OCEntityHandlerResult HandlePstatPostRequest(const OCEntityHandlerRequest
gPstat->om = pstat->om;
gPstat->tm = pstat->tm;
gPstat->cm = pstat->cm;
memcpy(&(gPstat->rownerID), &(pstat->rownerID), sizeof(OicUuid_t));
// Convert pstat data into CBOR for update to persistent storage
if (UpdatePersistentStorage(gPstat))
......
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