Update Snapshot(2018-02-28) 18/171318/1 submit/tizen_4.0_tv/20180301.224857
authorAmit <amit.s12@samsung.com>
Thu, 1 Mar 2018 06:10:50 +0000 (11:40 +0530)
committerAmit <amit.s12@samsung.com>
Thu, 1 Mar 2018 06:10:50 +0000 (11:40 +0530)
Change-Id: Ie839b5c1dee0a1a559d04b20a40f549b48e8da6f
Signed-off-by: Amit <amit.s12@samsung.com>
packaging/snapshot_history.txt
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c
resource/csdk/security/src/doxmresource.c
service/resource-encapsulation/src/resourceCache/include/ResourceCacheManager.h
service/resource-encapsulation/src/resourceCache/src/ResourceCacheManager.cpp

index b413230..a212b7f 100755 (executable)
@@ -1,3 +1,9 @@
+http://suprem.sec.samsung.net/jira/browse/CONPRO-1243
+
+commit_info_2018-02-28.txt
+
+commit_id: e5ace7ad29ce01019f79c00bdb3bdbd16f5fbf49
+----------------------------------------------------------------------------------------------------------------------------------
 http://suprem.sec.samsung.net/jira/browse/CONPRO-1237
 
 commit_info_2018-02-21.txt
index 7be3576..6dd925a 100644 (file)
@@ -1698,6 +1698,11 @@ static void SetupCipher(mbedtls_ssl_config * config, CATransportAdapter_t adapte
 
     memset(g_cipherSuitesList, 0, sizeof(g_cipherSuitesList));
 
+    if (SSL_CIPHER_MAX < g_caSslContext->cipher)
+    {
+        OIC_LOG(ERROR, NET_SSL_TAG, "Maximum ciphersuite index exceeded");
+    }
+
     // Add the preferred ciphersuite first
     if (SSL_CIPHER_MAX != g_caSslContext->cipher)
     {
@@ -1708,6 +1713,7 @@ static void SetupCipher(mbedtls_ssl_config * config, CATransportAdapter_t adapte
 
     // Add PSK ciphersuite
     if (true == g_caSslContext->cipherFlag[0] &&
+                SSL_CIPHER_MAX != g_caSslContext->cipher &&
                 MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 != tlsCipher[g_caSslContext->cipher][0])
     {
        g_cipherSuitesList[index] = MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256;
index 9eb0c76..ca176c6 100644 (file)
@@ -592,8 +592,13 @@ int32_t CASendTCPMulticastData(const CAEndpoint_t *endpoint,
                                const void *data, uint32_t dataLength,
                                CADataType_t dataType)
 {
+    (void)endpoint;
+    (void)data;
+    (void)dataLength;
     (void)dataType;
-    return CAQueueTCPData(true, endpoint, data, dataLength);
+
+    OIC_LOG(ERROR, TAG, "TCP adapter does not support multicast sending!");
+    return 0;
 }
 
 CAResult_t CAReadTCPData()
index 999c016..3128723 100644 (file)
@@ -48,6 +48,7 @@
 #include "srmutility.h"
 #include "pinoxmcommon.h"
 #include "oxmverifycommon.h"
+#include "octhread.h"
 
 #if defined(__WITH_DTLS__) || defined (__WITH_TLS__)
 #include "pkix_interface.h"
@@ -91,6 +92,8 @@ typedef enum ConfirmState{
 }ConfirmState_t;
 
 static OicSecDoxm_t        *gDoxm = NULL;
+static oc_mutex            g_mutexDoxm = NULL;
+static bool                g_isDoxmNull = false;
 static OCResourceHandle    gDoxmHandle = NULL;
 
 static OicSecOxm_t gOicSecDoxmJustWorks = OIC_JUST_WORKS;
@@ -160,6 +163,12 @@ void DeleteDoxmBinData(OicSecDoxm_t* doxm)
         //Clean doxm itself
         OICFree(doxm);
     }
+
+    if(g_mutexDoxm)
+    {
+        oc_mutex_free(g_mutexDoxm);
+        g_mutexDoxm = NULL;
+    }
 }
 
 OCStackResult DoxmToCBORPayload(const OicSecDoxm_t *doxm, uint8_t **payload, size_t *size,
@@ -1692,6 +1701,14 @@ OCEntityHandlerResult DoxmEntityHandler(OCEntityHandlerFlag flag,
         return ehRet;
     }
 
+    oc_mutex_lock(g_mutexDoxm);
+
+    if(g_isDoxmNull)
+    {
+        oc_mutex_unlock(g_mutexDoxm);
+        return OC_EH_SERVICE_UNAVAILABLE;
+    }
+
     if (flag & OC_REQUEST_FLAG)
     {
         OIC_LOG(DEBUG, TAG, "Flag includes OC_REQUEST_FLAG");
@@ -1717,6 +1734,8 @@ OCEntityHandlerResult DoxmEntityHandler(OCEntityHandlerFlag flag,
                                OC_EH_OK : OC_EH_ERROR;
                 break;
         }
+
+        oc_mutex_unlock(g_mutexDoxm);
     }
 
     return ehRet;
@@ -1913,6 +1932,15 @@ OCStackResult InitDoxmResource()
 {
     OCStackResult ret = OC_STACK_ERROR;
 
+    if (!g_mutexDoxm)
+    {
+        g_mutexDoxm = oc_mutex_new();
+            if(!g_mutexDoxm)
+            {
+                return OC_STACK_ERROR;
+            }
+    }
+
     gConfirmState = CONFIRM_STATE_READY;
     gConfirmMsgId = 0;
 
@@ -1940,6 +1968,10 @@ OCStackResult InitDoxmResource()
         gDoxm = GetDoxmDefault();
     }
 
+     oc_mutex_lock(g_mutexDoxm);
+     g_isDoxmNull = false;
+     oc_mutex_unlock(g_mutexDoxm);
+
     //In case of the server is shut down unintentionally, we should initialize the owner
     if(gDoxm && (false == gDoxm->owned))
     {
@@ -1976,19 +2008,23 @@ OCStackResult InitDoxmResource()
 
 OCStackResult DeInitDoxmResource()
 {
+    oc_mutex_lock(g_mutexDoxm);
     OCStackResult ret = OCDeleteResource(gDoxmHandle);
     if (gDoxm  != &gDefaultDoxm)
     {
         DeleteDoxmBinData(gDoxm);
     }
     gDoxm = NULL;
+    g_isDoxmNull = true;
 
     if (OC_STACK_OK == ret)
     {
+        oc_mutex_unlock(g_mutexDoxm);
         return OC_STACK_OK;
     }
     else
     {
+        oc_mutex_unlock(g_mutexDoxm);
         return OC_STACK_ERROR;
     }
 }
index 01b9921..ae02cac 100644 (file)
@@ -75,6 +75,7 @@ namespace OIC
                 static std::unique_ptr<std::list<DataCachePtr>> s_cacheDataList;
                 std::map<CacheID, DataCachePtr> cacheIDmap;
 
+                std::list<ObserveCache::Ptr> m_observeCacheList;
                 std::map<CacheID, ObserveCache::Ptr> observeCacheIDmap;
 
                 ResourceCacheManager() = default;
index 8a3f020..386e809 100644 (file)
@@ -88,6 +88,7 @@ namespace OIC
 
                 auto newHandler = std::make_shared<ObserveCache>(pResource);
                 newHandler->startCache(std::move(func));
+                m_observeCacheList.push_back(newHandler);
 
                 observeCacheIDmap.insert(std::make_pair(retID, newHandler));
                 return retID;
@@ -133,6 +134,7 @@ namespace OIC
             if ((dataCacheIns == cacheIDmap.end() && observeIns == observeCacheIDmap.end())
                 || id == 0)
             {
+                lock.~lock_guard();
                 throw RCSInvalidParameterException {"[cancelResourceCache] CacheID is invaild"};
             }
 
@@ -146,6 +148,7 @@ namespace OIC
                 {
                     (observeIns->second).reset();
                     observeCacheIDmap.erase(id);
+                    lock.~lock_guard();
                     throw;
                 }
                 (observeIns->second).reset();