From: Jongmin Choi Date: Wed, 5 Oct 2016 11:33:05 +0000 (+0900) Subject: [IOT-1395] Fix for rowneruuid update X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af5a8d016937d697919f44a55f39ee75082e71e7;p=contrib%2Fiotivity.git [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: Jongmin Choi Reviewed-on: https://gerrit.iotivity.org/gerrit/12807 Tested-by: jenkins-iotivity Reviewed-by: Nathan Heldt-Sheller Reviewed-by: Randeep Singh (cherry picked from commit dd82e65657fb6ef738b044a376d17f0ae86ed3ba) Reviewed-on: https://gerrit.iotivity.org/gerrit/12997 --- diff --git a/resource/csdk/security/src/aclresource.c b/resource/csdk/security/src/aclresource.c index a41f99e..e887a3e 100644 --- a/resource/csdk/security/src/aclresource.c +++ b/resource/csdk/security/src/aclresource.c @@ -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) diff --git a/resource/csdk/security/src/credresource.c b/resource/csdk/security/src/credresource.c index ea4c816..b4255c1 100644 --- a/resource/csdk/security/src/credresource.c +++ b/resource/csdk/security/src/credresource.c @@ -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; diff --git a/resource/csdk/security/src/pstatresource.c b/resource/csdk/security/src/pstatresource.c index a5ec8ae..63742c7 100644 --- a/resource/csdk/security/src/pstatresource.c +++ b/resource/csdk/security/src/pstatresource.c @@ -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))