diff options
author | Nathan Heldt-Sheller <nathan.heldt-sheller@intel.com> | 2017-04-23 21:02:04 -0700 |
---|---|---|
committer | Kevin Kane <kkane@microsoft.com> | 2017-04-26 23:06:56 +0000 |
commit | 4aa1474b84b7f16353da64808d03634affa99a77 (patch) | |
tree | e4ddaa709cd2acf854f99b0ac964409aaaaf0baa /resource/csdk/security/provisioning/src/oxmjustworks.c | |
parent | 6150c09877559778f1ef2c2ea20c30ec69bceee8 (diff) | |
download | iotivity-4aa1474b84b7f16353da64808d03634affa99a77.tar.gz iotivity-4aa1474b84b7f16353da64808d03634affa99a77.tar.bz2 iotivity-4aa1474b84b7f16353da64808d03634affa99a77.zip |
[IOT-1958] CR 22 State Specific Property Access for /doxm Resource
Implementation of CR 22 feature to deny UPDATE to /doxm if any
Property in the POST representation is read-only in the current
/pstat.dos.s state.
Includes necessary update to the CBOR marshalling code to support
partial Resource representations for /doxm.
Includes updates to provisioning tools to correctly include only the
/doxm Properties being updated in the POST payload.
Change-Id: I610012be5b19e0ac0218f9f8610cab5171187108
Signed-off-by: Nathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/19215
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Kevin Kane <kkane@microsoft.com>
Diffstat (limited to 'resource/csdk/security/provisioning/src/oxmjustworks.c')
-rw-r--r-- | resource/csdk/security/provisioning/src/oxmjustworks.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/resource/csdk/security/provisioning/src/oxmjustworks.c b/resource/csdk/security/provisioning/src/oxmjustworks.c index 47cfafe1e..244f7f1cc 100644 --- a/resource/csdk/security/provisioning/src/oxmjustworks.c +++ b/resource/csdk/security/provisioning/src/oxmjustworks.c @@ -33,7 +33,8 @@ #define TAG "OIC_OXM_JustWorks" -OCStackResult CreateJustWorksSelectOxmPayload(OTMContext_t *otmCtx, uint8_t **payload, size_t *size) +OCStackResult CreateJustWorksSelectOxmPayload(OTMContext_t *otmCtx, + uint8_t **payload, size_t *size) { if (!otmCtx || !otmCtx->selectedDeviceInfo || !payload || *payload || !size) { @@ -44,10 +45,16 @@ OCStackResult CreateJustWorksSelectOxmPayload(OTMContext_t *otmCtx, uint8_t **pa *payload = NULL; *size = 0; - return DoxmToCBORPayload(otmCtx->selectedDeviceInfo->doxm, payload, size, true); + bool propertiesToInclude[DOXM_PROPERTY_COUNT]; + memset(propertiesToInclude, 0, sizeof(propertiesToInclude)); + propertiesToInclude[DOXM_OXMSEL] = true; + + return DoxmToCBORPayloadPartial(otmCtx->selectedDeviceInfo->doxm, payload, + size, propertiesToInclude); } -OCStackResult CreateJustWorksOwnerTransferPayload(OTMContext_t* otmCtx, uint8_t **payload, size_t *size) +OCStackResult CreateJustWorksOwnerTransferPayload(OTMContext_t* otmCtx, + uint8_t **payload, size_t *size) { if (!otmCtx || !otmCtx->selectedDeviceInfo || !payload || *payload || !size) { @@ -66,7 +73,12 @@ OCStackResult CreateJustWorksOwnerTransferPayload(OTMContext_t* otmCtx, uint8_t *payload = NULL; *size = 0; - return DoxmToCBORPayload(otmCtx->selectedDeviceInfo->doxm, payload, size, true); + bool propertiesToInclude[DOXM_PROPERTY_COUNT]; + memset(propertiesToInclude, 0, sizeof(propertiesToInclude)); + propertiesToInclude[DOXM_DEVOWNERUUID] = true; + + return DoxmToCBORPayloadPartial(otmCtx->selectedDeviceInfo->doxm, payload, + size, propertiesToInclude); } OCStackResult LoadSecretJustWorksCallback(OTMContext_t* UNUSED_PARAM) @@ -147,6 +159,11 @@ OCStackResult CreateMVJustWorksSelectOxmPayload(OTMContext_t *otmCtx, uint8_t ** *cborPayload = NULL; *cborSize = 0; - return DoxmToCBORPayload(otmCtx->selectedDeviceInfo->doxm, cborPayload, cborSize, true); + bool propertiesToInclude[DOXM_PROPERTY_COUNT]; + memset(propertiesToInclude, 0, sizeof(propertiesToInclude)); + propertiesToInclude[DOXM_OXMSEL] = true; + + return DoxmToCBORPayloadPartial(otmCtx->selectedDeviceInfo->doxm, cborPayload, + cborSize, propertiesToInclude); } |