Merge tizen_5.0 codes into tizen_4.0
[platform/upstream/iotivity.git] / resource / csdk / security / src / pconfresource.c
index ab89e3c..3404a16 100644 (file)
 #include "logger.h"
 #include "oic_malloc.h"
 #include "oic_string.h"
+#if defined (__TIZENRT__)
+#include <apps/netutils/cJSON.h>
+#else
 #include "cJSON.h"
+#endif
 #include "base64.h"
 #include "ocpayload.h"
 #include "ocpayloadcbor.h"
@@ -397,7 +401,7 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si
     }
 
     //DeviceId -- Mandatory
-    //There may not be devicd id if caller is provisoning tool
+    //There may not be devicd id if caller is provisioning tool
     cborEncoderResult = cbor_encode_text_string(&pconfMap, OIC_JSON_DEVICE_ID_NAME,
             strlen(OIC_JSON_DEVICE_ID_NAME));
     VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to encode device id");
@@ -818,6 +822,7 @@ static OCEntityHandlerResult HandlePconfGetRequest (const OCEntityHandlerRequest
 {
     uint8_t* payload = NULL;
     size_t size = 0;
+    const OicSecDoxm_t *m_doxm = NULL;
     OCEntityHandlerResult ehRet = OC_EH_OK;
 
     OicSecPconf_t pconf;
@@ -825,7 +830,13 @@ static OCEntityHandlerResult HandlePconfGetRequest (const OCEntityHandlerRequest
 
     OIC_LOG (DEBUG, TAG, "Pconf EntityHandle processing GET request");
 
-    if (true == GetDoxmResourceData()->dpc)
+    m_doxm = GetDoxmResourceData();
+    if (NULL == m_doxm)
+    {
+      OIC_LOG (DEBUG, TAG, "Doxm resource Data is NULL");
+    }
+
+    if ((m_doxm) && (true == m_doxm->dpc))
     {
         //Making response elements for Get request
         if( (true == gPconf->edp) &&