[IOT-2269] Do not include rowner property in csr resource CBOR
authorKevin Kane <kkane@microsoft.com>
Wed, 17 May 2017 23:13:26 +0000 (16:13 -0700)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Fri, 19 May 2017 22:48:08 +0000 (22:48 +0000)
"rowner" property was being erroneously included in the CBOR
payload for the CSR resource, which caused the map in the
response to contain one more key/value pair than it should have.

This property should not be included as it is not part of the
specification for this resource.

Change-Id: I61a25535b79d21857b18f7f1f2bb077e8420b3f5
Signed-off-by: Kevin Kane <kkane@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20013
Reviewed-by: Alex Kelley <alexke@microsoft.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
resource/csdk/security/src/csrresource.c

index b2eeb41..ba1112c 100644 (file)
@@ -47,6 +47,8 @@
 
 #define TAG  "OIC_SRM_CSR"
 
+static const uint8_t CSR_MAP_SIZE = 4; // csr, encoding, RT, and IF
+
 static OCResourceHandle    gCsrHandle = NULL;
 
 /** Default cbor payload size. This value is increased in case of CborErrorOutOfMemory.
@@ -147,7 +149,7 @@ static OCStackResult CSRToCBORPayload(const uint8_t *csr, size_t csrLen, OicEnco
     cbor_encoder_init(&encoder, outPayload, cborLen, 0);
 
     // Create CSR Root Map (csr)
-    cborEncoderResult = cbor_encoder_create_map(&encoder, &csrRootMap, 4);
+    cborEncoderResult = cbor_encoder_create_map(&encoder, &csrRootMap, CSR_MAP_SIZE);
     VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding CSR Root Map");
 
     // Create CSR string entry
@@ -164,22 +166,6 @@ static OCStackResult CSRToCBORPayload(const uint8_t *csr, size_t csrLen, OicEnco
     cborEncoderResult = cbor_encode_text_string(&csrRootMap, strEncoding, strlen(strEncoding));
     VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding encoding value.");
 
-    // Rownerid
-    {
-        char *rowner = NULL;
-        OicUuid_t myUuid;
-        cborEncoderResult = cbor_encode_text_string(&csrRootMap, OIC_JSON_ROWNERID_NAME,
-            strlen(OIC_JSON_ROWNERID_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding rownerid Name.");
-        ret = GetDoxmDeviceID(&myUuid);
-        VERIFY_SUCCESS(TAG, OC_STACK_OK == ret, ERROR);
-        ret = ConvertUuidToStr(&myUuid, &rowner);
-        VERIFY_SUCCESS(TAG, OC_STACK_OK == ret, ERROR);
-        cborEncoderResult = cbor_encode_text_string(&csrRootMap, rowner, strlen(rowner));
-        OICFree(rowner);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding rownerid Value.");
-    }
-
     //RT -- Mandatory
     CborEncoder rtArray;
     cborEncoderResult = cbor_encode_text_string(&csrRootMap, OIC_JSON_RT_NAME,