remove db_util dependency 92/156292/1 accepted/tizen_4.0_unified accepted/tizen/4.0/unified/20171019.235106 submit/tizen_4.0/20171018.025704 submit/tizen_4.0/20171019.002831 submit/tizen_4.0/20171019.042440 tizen_4.0.IoT.p2_release tizen_4.0.m2_release
authorjungkon.kim <jungkon.kim@samsung.com>
Wed, 18 Oct 2017 02:48:53 +0000 (11:48 +0900)
committerjungkon.kim <jungkon.kim@samsung.com>
Wed, 18 Oct 2017 02:48:59 +0000 (11:48 +0900)
Change-Id: I331d3065d7e07aaf8db5258d8dfb6b60f1e40324

client/CMakeLists.txt
client/inc/PrivacyChecker.h [deleted file]
client/src/PrivacyChecker.cpp [deleted file]
client/src/privacy_guard_client.cpp
common/inc/PrivacyGuardCommon.h
common/inc/Utils.h
packaging/privacy-guard.spec
server/CMakeLists.txt

index d09fd5ab2237c487424f4a4201ee69dc08ed91b5..0e0fcfe9b982967a316634f65dbf39f4edd00f15 100755 (executable)
@@ -10,7 +10,7 @@ SET(LIBDIR ${LIB_INSTALL_DIR})
 SET(INCLUDEDIR ${INCLUDE_INSTALL_DIR})
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(privacy-guard-client REQUIRED dlog sqlite3 dbus-1 dbus-glib-1 db-util libtzplatform-config libpcre)
+pkg_check_modules(privacy-guard-client REQUIRED dlog sqlite3 dbus-1 dbus-glib-1 libtzplatform-config libpcre)
 
 FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
@@ -49,7 +49,6 @@ SET(PRIVACY_GUARD_CLIENT_SOURCES
        ${common_src_dir}/Utils.cpp
        ${common_src_dir}/privacy_guard_utils.c
        ${client_src_dir}/SocketClient.cpp
-       ${client_src_dir}/PrivacyChecker.cpp
        ${client_src_dir}/PrivacyGuardClient.cpp
        ${client_src_dir}/privacy_guard_client.cpp
        ${client_src_dir}/privacy_guard_dlp.cpp
@@ -60,7 +59,6 @@ SET(PRIVACY_GUARD_CLIENT_SOURCES
        ${ahocorasick_dir}/node.c
        )
 SET(PRIVACY_GUARD_CLIENT_HEADERS
-       ${client_include_dir}/PrivacyChecker.h
        ${client_include_dir}/PrivacyGuardClient.h
        ${client_include_dir}/DlpPacketParserResult.h
        ${client_include_dir}/DlpPacketParser.h
diff --git a/client/inc/PrivacyChecker.h b/client/inc/PrivacyChecker.h
deleted file mode 100644 (file)
index 9f01a8a..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-/**
- * @file       PrivacyChecker.h
- */
-
-#ifndef _PRIVACY_CHECKER_H_
-#define _PRIVACY_CHECKER_H_
-
-#include <string>
-#include <mutex>
-#include <list>
-#include <vector>
-#include <memory>
-#include <map>
-#include <dbus/dbus.h>
-#include <glib.h>
-#include "PrivacyGuardTypes.h"
-
-struct sqlite3;
-
-class EXTERN_API PrivacyChecker
-{
-private:
-       static std::map < std::string, bool > m_privacyCache;
-       static std::map < std::string, std::map < std::string, bool > > m_privacyInfoCache;
-       static std::map < std::string, int > m_monitorPolicyCache;
-       static std::string m_pkgId;
-       static bool m_isInitialized;
-       static bool m_isMonitorEnable;
-       static std::mutex m_cacheMutex;
-       static std::mutex m_dbusMutex;
-       static std::mutex m_initializeMutex;
-       static DBusConnection* m_pDBusConnection;
-       static GMainLoop* m_pLoop;
-       static GMainContext* m_pHandlerGMainContext;
-       static pthread_t m_signalThread;
-
-private:
-       static int initializeDbus(void);
-       static int finalizeDbus(void);
-       static int updateCache(const std::string pkgId, std::string privacyId, std::map<std::string, bool> &pkgCacheMap);
-       static int updateCache(const std::string pkgId, std::map<std::string, bool> &pkgCacheMap);
-       static void printCache(void);
-       static void* runSignalListenerThread(void *pData);
-       static int getCurrentPkgId(std::string &pkgId);
-       static int check(const std::string privacyId, std::map<std::string, bool> &privacyMap);
-
-public:
-       // for Checking in App Process
-       static int initialize(void);
-       static int check(const std::string pkgId, const std::string privacyId);
-       static int checkWithDeviceCap(const std::string pkgId, const std::string deviceCap);
-
-       // for Checking in Server Process
-       static int initializeGMain(void);
-       static int check(const std::string privacyId);
-       static void checkMonitorByPrivilege(const std::string privilegeId);
-       static int checkWithDeviceCap(const std::string deviceCap);
-       static void printMonitorPolicyCache(void);
-       static int initMonitorPolicyCache(void);
-       static int getMonitorPolicy(const int userId, const std::string packageId, const std::string privacyId, int &monitorPolicy);
-
-       // common
-       static int finalize(void);
-       static DBusHandlerResult handleNotification(DBusConnection *connection, DBusMessage *message, void *user_data);
-};
-
-#endif // _PRIVACY_CHECKER_H_
diff --git a/client/src/PrivacyChecker.cpp b/client/src/PrivacyChecker.cpp
deleted file mode 100644 (file)
index 8bc8b92..0000000
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-/**
- * @file       PrivacyChecker.cpp
- */
-
-#include <algorithm>
-#include <memory>
-#include <sqlite3.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <privilege_info.h>
-#include "PrivacyChecker.h"
-#include "PrivacyIdInfo.h"
-#include "PrivacyGuardClient.h"
-#include "SocketClient.h"
-#include "Utils.h"
-
-#define BUF_SIZE 256
-
-bool PrivacyChecker::m_isInitialized = false;
-bool PrivacyChecker::m_isMonitorEnable = false;
-std::map < std::string, bool >PrivacyChecker::m_privacyCache;
-std::map < std::string, std::map < std::string, bool > > PrivacyChecker::m_privacyInfoCache;
-std::map < std::string, int > PrivacyChecker::m_monitorPolicyCache;
-std::mutex PrivacyChecker::m_cacheMutex;
-std::mutex PrivacyChecker::m_dbusMutex;
-std::mutex PrivacyChecker::m_initializeMutex;
-std::string PrivacyChecker::m_pkgId;
-DBusConnection* PrivacyChecker::m_pDBusConnection;
-GMainLoop* PrivacyChecker::m_pLoop = NULL;
-GMainContext* PrivacyChecker::m_pHandlerGMainContext = NULL;
-const int MAX_LOCAL_BUF_SIZE = 128;
-pthread_t PrivacyChecker::m_signalThread;
-
-int
-PrivacyChecker::initialize(void)
-{
-       if (m_isInitialized) {
-               return PRIV_GUARD_ERROR_SUCCESS;
-       }
-
-       std::lock_guard < std::mutex > guard(m_cacheMutex);
-
-       int res = initMonitorPolicyCache();
-       TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, , "Failed to update cache (%d)", res);
-
-       res = initializeGMain();
-       TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, , "Failed to initialize() (%d)", res);
-
-       return PRIV_GUARD_ERROR_SUCCESS;
-}
-
-int
-PrivacyChecker::initializeGMain(void)
-{
-       std::unique_lock<std::mutex> initlock(m_initializeMutex);
-
-       TryReturn(!m_isInitialized, PRIV_GUARD_ERROR_SUCCESS, , "Already Initalized");
-
-       m_pHandlerGMainContext = g_main_context_new();
-       TryReturn(m_pHandlerGMainContext != NULL, PRIV_GUARD_ERROR_SYSTEM_ERROR, , "cannot create m_pHandlerGMainContext");
-
-       m_pLoop = g_main_loop_new(m_pHandlerGMainContext, FALSE);
-       TryReturn(m_pLoop != NULL, PRIV_GUARD_ERROR_SYSTEM_ERROR, , "cannot create m_pLoop");
-
-       std::unique_lock<std::mutex> lock(m_dbusMutex);
-       char buf[BUF_SIZE];
-       int res = pthread_create(&m_signalThread, NULL, &runSignalListenerThread, NULL);
-       TryReturn(res >= 0, PRIV_GUARD_ERROR_SYSTEM_ERROR, errno = res;, "Failed to create listener thread :%s", strerror_r(res, buf, sizeof(buf)));
-
-       m_isInitialized = true;
-
-       return PRIV_GUARD_ERROR_SUCCESS;
-}
-
-void
-PrivacyChecker::printMonitorPolicyCache(void)
-{
-       for(std::map<std::string, int>::iterator itr = m_monitorPolicyCache.begin(); itr != m_monitorPolicyCache.end(); itr++) {
-               PG_LOGD("PRIVACY string : %s", itr->first.c_str());
-               PG_LOGD("PRIVACY monitor_policy : %d", itr->second);
-       }
-}
-
-int
-PrivacyChecker::initMonitorPolicyCache(void)
-{
-       std::list < std::pair < std::string, int > > monitorPolicyList;
-
-       int retval = PrivacyGuardClient::getInstance()->PgGetAllMonitorPolicy(monitorPolicyList);
-       if(retval == PRIV_GUARD_ERROR_SUCCESS && !monitorPolicyList.empty()) {
-               m_monitorPolicyCache.insert(monitorPolicyList.begin(), monitorPolicyList.end());
-       } else {
-               PG_LOGD("ret: [%d], monitorPolicyList size: [%d]", retval, monitorPolicyList.size());
-       }
-
-       return retval;
-}
-
-int
-PrivacyChecker::getMonitorPolicy(const int userId, const std::string packageId, const std::string privacyId, int &monitorPolicy)
-{
-       int res = PRIV_GUARD_ERROR_SUCCESS;
-       PG_LOGD("m_isInitialized: %d", m_isInitialized);
-
-       if (m_isInitialized == false) {
-               initialize();
-       }
-
-       std::string userPkgIdPrivacyId = std::to_string(userId) + std::string("|") + packageId + std::string("|") + privacyId;
-       PG_LOGD("key: %s", userPkgIdPrivacyId.c_str());
-       std::map<std::string, int>::iterator itr = m_monitorPolicyCache.find(userPkgIdPrivacyId);
-
-       if(itr != m_monitorPolicyCache.end()) {
-               monitorPolicy = itr->second;
-       } else  {
-               monitorPolicy = 0;
-               res = PRIV_GUARD_ERROR_NO_DATA;
-       }
-
-       return res;
-}
-
-void
-PrivacyChecker::checkMonitorByPrivilege(const std::string privilegeId)
-{
-       PG_LOGD("checkMonitorByPrivilege called with privilege: [%s]", privilegeId.c_str());
-
-       if (privilege_info_is_privacy(privilegeId.c_str()))     {
-               m_isMonitorEnable = true;
-       } else  {
-               PG_LOGD("[%s] is not related to a privacy.", privilegeId.c_str());
-               m_isMonitorEnable = false;
-       }
-}
-
-void*
-PrivacyChecker::runSignalListenerThread(void* pData)
-{
-       pthread_detach(pthread_self());
-
-       PG_LOGI("Running g main loop for signal");
-
-       initializeDbus();
-
-       g_main_loop_run(m_pLoop);
-
-       finalizeDbus();
-
-       pthread_exit(NULL);
-
-       return (void*) 0;
-}
-
-int
-PrivacyChecker::initializeDbus(void)
-{
-       DBusError error;
-       dbus_error_init(&error);
-
-       m_pDBusConnection = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
-       TryReturn(m_pDBusConnection != NULL, PRIV_GUARD_ERROR_SYSTEM_ERROR, dbus_error_free(&error), "dbus_bus_get_private [%s] : %d", PRIV_GUARD_ERROR_SYSTEM_ERROR);
-
-       dbus_connection_setup_with_g_main(m_pDBusConnection, m_pHandlerGMainContext);
-       std::unique_ptr < char[] > pRule(new char[MAX_LOCAL_BUF_SIZE]);
-
-       snprintf(pRule.get(), MAX_LOCAL_BUF_SIZE, "path='%s',type='signal',interface='%s'", DBUS_PATH.c_str(), DBUS_SIGNAL_INTERFACE.c_str());
-       dbus_bus_add_match(m_pDBusConnection, pRule.get(), &error);
-       TryReturn(!dbus_error_is_set(&error), PRIV_GUARD_ERROR_SYSTEM_ERROR, dbus_error_free(&error), "dbus_bus_add_match[%s] : %d", error.message, PRIV_GUARD_ERROR_SYSTEM_ERROR);
-
-       dbus_bool_t r = dbus_connection_add_filter(m_pDBusConnection, handleNotification, NULL, NULL);
-       TryReturn(r, PRIV_GUARD_ERROR_SYSTEM_ERROR, , "dbus_connection_add_filter: %d", PRIV_GUARD_ERROR_SYSTEM_ERROR);
-
-       return PRIV_GUARD_ERROR_SUCCESS;
-}
-
-int
-PrivacyChecker::finalizeDbus(void)
-{
-       dbus_connection_remove_filter(m_pDBusConnection, handleNotification, NULL);
-       dbus_connection_close(m_pDBusConnection);
-       m_pDBusConnection = NULL;
-
-       return PRIV_GUARD_ERROR_SUCCESS;
-}
-
-
-DBusHandlerResult
-PrivacyChecker::handleNotification(DBusConnection* connection, DBusMessage* message, void* user_data)
-{
-       DBusError error;
-       dbus_bool_t r;
-       dbus_error_init(&error);
-
-       char* pPkgId;
-       char* pPrivacyId;
-
-       if (dbus_message_is_signal(message, DBUS_SIGNAL_INTERFACE.c_str(), DBUS_SIGNAL_SETTING_CHANGED.c_str())) {
-               r = dbus_message_get_args(message, &error,
-                       DBUS_TYPE_STRING, &pPkgId,
-                       DBUS_TYPE_STRING, &pPrivacyId,
-                       DBUS_TYPE_INVALID);
-               TryReturn(r, DBUS_HANDLER_RESULT_NOT_YET_HANDLED, , "Fail to get data : %s", error.message);
-
-               std::lock_guard < std::mutex > guard(m_cacheMutex);
-
-               if (std::string(pPkgId) == m_pkgId)
-               {
-                       PG_LOGI("Current app pkg privacy information updated");
-                       updateCache(m_pkgId, pPrivacyId, m_privacyCache);
-                       //printCache();
-               }
-
-               std::map < std::string, std::map < std::string, bool > > :: iterator iter = m_privacyInfoCache.find(std::string(pPkgId));
-               if (iter != m_privacyInfoCache.end()) {
-                       PG_LOGI("Current pkg privacy is in cache");
-                       updateCache(std::string(pPkgId), pPrivacyId, iter->second);
-               }
-       } else if (dbus_message_is_signal(message, DBUS_SIGNAL_INTERFACE.c_str(), DBUS_SIGNAL_PKG_REMOVED.c_str())) {
-               r = dbus_message_get_args(message, &error,
-                       DBUS_TYPE_STRING, &pPkgId,
-                       DBUS_TYPE_INVALID);
-               TryReturn(r, DBUS_HANDLER_RESULT_NOT_YET_HANDLED, , "Fail to get data : %s", error.message);
-
-               std::lock_guard < std::mutex > guard(m_cacheMutex);
-
-               std::map < std::string, std::map < std::string, bool > > :: iterator iter = m_privacyInfoCache.find(std::string(pPkgId));
-               if (iter != m_privacyInfoCache.end()) {
-                       m_privacyInfoCache.erase(iter);
-               }
-       }
-
-       // This event is not only for specific handler. All handlers of daemons should be check it and handle it.
-       return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-int
-PrivacyChecker::check(const std::string privacyId, std::map < std::string, bool >& privacyMap)
-{
-       TryReturn(m_isInitialized, PRIV_GUARD_ERROR_NOT_INITIALIZED, , "Not initialized");
-
-       std::map < std::string, bool >::iterator iter;
-
-       iter = privacyMap.find(privacyId);
-       if (iter == privacyMap.end()) {
-               PG_LOGD("The application cannot access the privacy inforamtion.");
-               return PRIV_GUARD_ERROR_USER_NOT_CONSENTED;
-       } else if (!iter->second) {
-               PG_LOGD("User does not consented to access the privacy information");
-               return PRIV_GUARD_ERROR_USER_NOT_CONSENTED;
-       }
-
-       return PRIV_GUARD_ERROR_SUCCESS;
-}
-
-int
-PrivacyChecker::check(const std::string privacyId)
-{
-       if (!m_isInitialized)
-               return PRIV_GUARD_ERROR_NOT_INITIALIZED;
-
-       std::lock_guard < std::mutex > guard(m_cacheMutex);
-
-       int res = check(privacyId, m_privacyCache);
-
-       return res;
-}
-
-int
-PrivacyChecker::check(const std::string pkgId, const std::string privacyId)
-{
-       if (!m_isInitialized)
-               initialize();
-
-       std::lock_guard < std::mutex > guard(m_cacheMutex);
-       int res;
-
-       std::map < std::string, std::map < std::string, bool > >::iterator iter = m_privacyInfoCache.find(pkgId);
-       if (iter == m_privacyInfoCache.end() )
-       {
-               std::map < std::string, bool > pkgCacheMap;
-               res = updateCache(pkgId, pkgCacheMap);
-               TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, PRIV_GUARD_ERROR_DB_ERROR, , "Failed to update cache : %d", res);
-
-               m_privacyInfoCache.insert(std::map <std::string, std::map<std::string, bool>>::value_type(std::string(pkgId), pkgCacheMap));
-               iter = m_privacyInfoCache.find(pkgId);
-       }
-
-       if (iter->second.size() == 0)
-       {
-               return PRIV_GUARD_ERROR_USER_NOT_CONSENTED;
-       }
-
-       res = check(privacyId, iter->second);
-
-       return res;
-}
-
-int
-PrivacyChecker::finalize(void)
-{
-       std::lock_guard<std::mutex> guard(m_cacheMutex);
-       m_privacyCache.clear();
-       m_privacyInfoCache.clear();
-
-       if (m_pLoop != NULL)
-       {
-               g_main_loop_quit(m_pLoop);
-               m_pLoop = NULL;
-       }
-
-       if (m_pHandlerGMainContext != NULL)
-       {
-               g_main_context_unref(m_pHandlerGMainContext);
-               m_pHandlerGMainContext = NULL;
-       }
-
-       m_isInitialized = false;
-
-       return PRIV_GUARD_ERROR_SUCCESS;
-}
-
-void
-PrivacyChecker::printCache(void)
-{
-       std::map < std::string, bool >::const_iterator iter = m_privacyCache.begin();
-       for (; iter != m_privacyCache.end(); ++iter)
-       {
-               PG_LOGD(" %s : %d", iter->first.c_str(), iter->second);
-       }
-}
-
-int
-PrivacyChecker::updateCache(const std::string pkgId, std::string privacyId, std::map < std::string, bool >& pkgCacheMap)
-{
-       static const std::string PrivacyQuery = "SELECT IS_ENABLED from PrivacyInfo where PKG_ID=? and PRIVACY_ID=?";
-
-       openDb(PRIVACY_DB_PATH, pDbH, SQLITE_OPEN_READONLY);
-       prepareDb(pDbH, PrivacyQuery.c_str(), pPrivacyStmt);
-       int res = sqlite3_bind_text(pPrivacyStmt.get(), 1, pkgId.c_str(),  -1, SQLITE_TRANSIENT);
-       TryReturn(res == 0, PRIV_GUARD_ERROR_DB_ERROR, , "sqlite3_bind_text : %d", res);
-
-       res = sqlite3_bind_text(pPrivacyStmt.get(), 2, privacyId.c_str(),  -1, SQLITE_TRANSIENT);
-       TryReturn(res == 0, PRIV_GUARD_ERROR_DB_ERROR, , "sqlite3_bind_text : %d", res);
-
-       while ( sqlite3_step(pPrivacyStmt.get()) == SQLITE_ROW )
-       {
-               bool privacyEnabled = sqlite3_column_int(pPrivacyStmt.get(), 0) > 0 ? true : false;
-
-               PG_LOGD("Set result : %s : %d", privacyId.c_str(), privacyEnabled);
-               pkgCacheMap.erase(privacyId);
-               pkgCacheMap.insert(std::map < std::string, bool >::value_type(privacyId, privacyEnabled));
-       }
-
-       return PRIV_GUARD_ERROR_SUCCESS;
-}
-
-int
-PrivacyChecker::updateCache(std::string pkgId, std::map < std::string, bool >& pkgCacheMap)
-{
-       static const std::string PrivacyQuery = "SELECT PRIVACY_ID, IS_ENABLED from PrivacyInfo where PKG_ID=?";
-
-       pkgCacheMap.clear();
-
-       openDb(PRIVACY_DB_PATH, pDbH, SQLITE_OPEN_READONLY);
-       prepareDb(pDbH, PrivacyQuery.c_str(), pPrivacyStmt);
-       int res = sqlite3_bind_text(pPrivacyStmt.get(), 1, pkgId.c_str(), -1, SQLITE_TRANSIENT);
-       TryReturn(res == SQLITE_OK, PRIV_GUARD_ERROR_DB_ERROR, , "sqlite3_bind_text : %d", res);
-
-       while ( (res = sqlite3_step(pPrivacyStmt.get())) == SQLITE_ROW )
-       {
-               const char* privacyId =  reinterpret_cast < const char* > (sqlite3_column_text(pPrivacyStmt.get(), 0));
-               bool privacyEnabled = sqlite3_column_int(pPrivacyStmt.get(), 1) > 0 ? true : false;
-
-               pkgCacheMap.insert(std::map < std::string, bool >::value_type(std::string(privacyId), privacyEnabled));
-
-               PG_LOGD("Privacy found : %s %d", privacyId, privacyEnabled);
-       }
-       return PRIV_GUARD_ERROR_SUCCESS;
-}
index bf1137a0bef0f7cabbb15fcf4893c774a1415dbc..2efa932f31e6bbdc3783fb980aa8848da2bd3520 100644 (file)
@@ -22,7 +22,6 @@
 #include <string.h>
 #include <string>
 #include <memory>
-#include "PrivacyChecker.h"
 #include "PrivacyGuardClient.h"
 #include "privacy_guard_client.h"
 #include "privacy_guard_client_internal.h"
index b28fcc054832ff10f4d7a530dcb13f17053d12c6..44fcf84a2507dfa03d64d78eb33e443a310b9ce0 100644 (file)
@@ -22,7 +22,6 @@
 #define _PRIVACY_GUARD_COMMON_H_
 
 #include <sqlite3.h>
-#include <db-util.h>
 #include <stdbool.h>
 
 #endif // _PRIVACY_GUARD_COMMON_H_
index fb2d45b306172e40b6d8f51739aa5d9ee782fd5f..276e2f897aee1fb33d1ce4d888c21620a5904b47 100755 (executable)
@@ -29,7 +29,6 @@
 #include <memory>
 #include <string>
 #include <unistd.h>
-#include <db-util.h>
 #include "privacy_guard_utils.h"
 
 // debug print /////////////////////////////////////////////
                        var = NULL;                                             \
                }
 
-auto StmtDeleter = [&](sqlite3_stmt* pPtr) { sqlite3_reset(pPtr); sqlite3_finalize(pPtr); };
-auto DbDeleter = [&](sqlite3* pPtr) { /*sqlite3_close(pPtr);*/ db_util_close(pPtr); };
-
-#define setStmtToUniquePtr(x, y)               std::unique_ptr < sqlite3_stmt, decltype(StmtDeleter) > x (y, StmtDeleter);
-#define setDbToUniquePtr(x, y)                 std::unique_ptr < sqlite3, decltype(DbDeleter) > x (y, DbDeleter);
-
-#define openDb(dbpath, pHandler, mode) sqlite3* pHandler##Temp = NULL;                                                                                         \
-       {                                                                                                                                                                                                                               \
-               /*int res = sqlite3_open_v2(dbpath, &pHandler##Temp, mode , NULL);*/                                                                            \
-               int res = db_util_open_with_options(dbpath, &pHandler##Temp, mode, NULL);                                                                       \
-               TryCatchResLogReturn(res == SQLITE_OK, , PRIV_GUARD_ERROR_DB_ERROR, "db_util_open_with_options : %d", res);     \
-       }                                                                                                                                                                                                                               \
-       setDbToUniquePtr(pHandler, pHandler##Temp);                                                                                                                                             \
-
 static const int MAX_DATABASE_RETRY_COUNT = 5;
 static const int SLEEP_TIME = 50000;
 #define prepareDb(pHandler, sql, pStmt)        sqlite3_stmt* pStmt##Temp;                                                                                              \
index c35f7c37a97ff3556c71350cca4e152c08da3f41..db1b48223655cca9135a8a3cb83fadc4a06a636d 100644 (file)
@@ -14,7 +14,7 @@ Source1004:     privacy-guard-client-devel.manifest
 BuildRequires:  cmake
 BuildRequires:  gettext-tools
 BuildRequires:  pkgconfig(capi-base-common)
-BuildRequires:  pkgconfig(db-util)
+#BuildRequires:  pkgconfig(db-util)
 BuildRequires:  pkgconfig(dbus-1)
 BuildRequires:  pkgconfig(dbus-glib-1)
 BuildRequires:  pkgconfig(dlog)
index 64e0671c10cfba544f0e05bd99c8d0740471451d..a5d60ec327f30c92018f94d7420d8012ff28a38f 100755 (executable)
@@ -9,7 +9,7 @@ SET(EXEC_PREFIX "\${prefix}")
 SET(INCLUDEDIR "\${prefix}/include")
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED dlog sqlite3 dbus-1 dbus-glib-1 db-util pkgmgr-info capi-system-info
+pkg_check_modules(pkgs REQUIRED dlog sqlite3 dbus-1 dbus-glib-1 pkgmgr-info capi-system-info
        libtzplatform-config security-privilege-manager cynara-monitor security-manager aul
        capi-telephony capi-network-connection capi-network-wifi capi-location-manager
        contacts-service2)