changed the access rights of db files root->system 06/67706/2 accepted/tizen/common/20160428.145112 accepted/tizen/mobile/20160429.011654 submit/tizen/20160428.084941
authorKyoungyong Lee <bluevox@naver.com>
Thu, 28 Apr 2016 06:09:13 +0000 (15:09 +0900)
committerKyoungyong Lee <bluevox@naver.com>
Thu, 28 Apr 2016 06:48:02 +0000 (15:48 +0900)
Change-Id: Ie7c3589eaa010e9098bea9028283e1ba8c944b64

client/inc/SocketClient.h
client/src/PrivacyGuardClient.cpp
packaging/privacy-guard.spec
pkgmgr_plugin/CMakeLists.txt
pkgmgr_plugin/privileges.cpp
res/usr/bin/privacy_guard_create_clean_db.sh
server/src/PrivacyGuardDb.cpp
server/src/service/PrivacyInfoService.cpp

index ba2f538..c88ee17 100755 (executable)
@@ -46,9 +46,8 @@
  * Structures and classes are not (yet) supported.
  */
 
-#include <string>
-#include <PrivacyGuardTypes.h>
-#include <Utils.h>
+#include "PrivacyGuardTypes.h"
+#include "Utils.h"
 
 class EXTERN_API SocketClient
 {
index 4c90732..fbac6f2 100755 (executable)
@@ -107,22 +107,24 @@ PrivacyGuardClient::PgAddPrivacyAccessLogBeforeTerminate(void)
 int
 PrivacyGuardClient::PgAddMonitorPolicy(const int userId, const std::string pkgId, const std::list < std::string >& list, int monitorPolicy)
 {
-       LOGD("[STHAN] PgAddMonitorPolicy - START");
-
        std::list < std::string > privacyList;
 
        int res = PrivacyIdInfo::getPrivacyIdListFromPrivilegeList(list, privacyList);
-       if (res != PRIV_GUARD_ERROR_SUCCESS )
+       if (res != PRIV_GUARD_ERROR_SUCCESS ) {
+               PG_LOGD("PrivacyIdInfo::getPrivacyIdListFromPrivilegeList() is failed. [%d]", res);
                return res;
+       }
 
-       if (privacyList.size() == 0)
+       if (privacyList.size() == 0) {
+               PG_LOGD("PrivacyGuardClient::PgAddMonitorPolicy: privacyList.size() is 0.");
                return PRIV_GUARD_ERROR_SUCCESS;
-
-       int result = PRIV_GUARD_ERROR_SUCCESS;
+       }
 
        res = m_pSocketClient->connect();
        TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, , "connect : %d", res);
 
+       int result = PRIV_GUARD_ERROR_SUCCESS;
+
        res = m_pSocketClient->call("PgAddMonitorPolicy", userId, pkgId, privacyList, monitorPolicy, &result);
        TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, m_pSocketClient->disconnect(), "call : %d", res);
 
index f50f614..95ada4f 100755 (executable)
@@ -123,6 +123,7 @@ fi
 %license  LICENSE.APLv2
 %manifest privacy-guard-client.manifest
 %{_libdir}/libprivacy-guard-client.so*
+%{_sysconfdir}/package-manager/parserlib/libprivileges.so
 
 %files -n privacy-guard-client-devel
 %defattr(-,root,root,-)
index 40ec970..f02c398 100755 (executable)
@@ -17,6 +17,7 @@ INCLUDE_DIRECTORIES(
     /usr/include/libxml2
     /usr/include/package_manager
     /usr/include/dlog
+    /usr/include/db-util
     "${CMAKE_SOURCE_DIR}/client/inc/"
     "${CMAKE_SOURCE_DIR}/common/inc/"
     "${CMAKE_SOURCE_DIR}/include/"
@@ -45,11 +46,11 @@ ADD_DEPENDENCIES(${this_target} privacy-guard-client)
 ## SET LINKER FLAGS
 SET(CMAKE_SHARED_LINKER_FLAGS -Wl,--no-undefined)
 ## SET PRIVACY_POPUP FLAG
-OPTION (PRIVACY_POPUP "PRIVACY_POPUP" ON)
-IF(PRIVACY_POPUP)
-       MESSAGE("PRIVACY_POPUP IS ENABLED")
-       ADD_DEFINITIONS("-D__PRIVACY_POPUP")
-ENDIF(PRIVACY_POPUP)
+#OPTION (PRIVACY_POPUP "PRIVACY_POPUP" ON)
+#IF(PRIVACY_POPUP)
+#      MESSAGE("PRIVACY_POPUP IS ENABLED")
+#      ADD_DEFINITIONS("-D__PRIVACY_POPUP")
+#ENDIF(PRIVACY_POPUP)
 
 
 TARGET_LINK_LIBRARIES(${this_target} ${pkg_LDFLAGS} ${pkg_LIBRARIES})
@@ -63,4 +64,8 @@ ADD_CUSTOM_COMMAND(TARGET ${this_target}
         )
 
 #INSTALL(TARGETS ${this_target} DESTINATION "../etc/package-manager/parserlib")
+#INSTALL(TARGETS ${this_target} DESTINATION "/etc/package-manager/parserlib")
+#INSTALL(TARGETS ${this_target} DESTINATION ${_sysconfdir}/package-manager/parserlib)
+#INSTALL(TARGETS ${this_target} DESTINATION "etc/package-manager/parserlib")
+INSTALL(TARGETS ${this_target} DESTINATION ${SYSCONF_INSTALL_DIR}/package-manager/parserlib/)
 
index 5d32a6a..8ee8c60 100755 (executable)
@@ -23,6 +23,7 @@
 #include <string>
 #include "privacy_guard_client_internal.h"
 #include "PrivacyGuardClient.h"
+#include "Utils.h"
 
 static const xmlChar _NODE_PRIVILEGES[]                = "privileges";
 static const xmlChar _NODE_PRIVILEGE[]         = "privilege";
@@ -41,8 +42,8 @@ void destroy_char_list(char** ppList, int size)
 extern "C"
 __attribute__ ((visibility("default")))
 int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char* packageId)
-{
-       LOGD("[STHAN] PKGMGR_PARSER_PLUGIN_INSTALL - START");
+{      
+       PG_LOGD("PKGMGR_PARSER_PLUGIN_INSTALL() called.");
 
        int ret = 0;
 
@@ -65,7 +66,7 @@ int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char* packageId)
 
                        if (pPrivilege == NULL)
                        {
-                               LOGE("Failed to get value");
+                               PG_LOGE("Failed to get value");
                                return -EINVAL;
                        }
             else
@@ -105,14 +106,14 @@ int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char* packageId)
 
        while (*ppPrivilegeList[0] != '\0')
        {
-               LOGD("privacyList : %s", *ppPrivilegeList);
+               PG_LOGD("privacyList : %s", *ppPrivilegeList);
                privilege_List.push_back(std::string(*ppPrivilegeList++));
        }
        ret = pInst->PgAddMonitorPolicy(user_id, std::string(packageId), privilege_List, monitor_policy);
        destroy_char_list(ppPrivilegeList, privilegeList.size() + 1);
        if (ret != PRIV_GUARD_ERROR_SUCCESS)
        {
-               LOGD("Failed to install monitor policy: %d", ret);
+               PG_LOGD("Failed to install monitor policy: %d", ret);
                return -EINVAL;
        }
 
@@ -123,7 +124,7 @@ extern "C"
 __attribute__ ((visibility("default")))
 int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr docPtr, const char* packageId)
 {
-       LOGD("[STHAN] PKGMGR_PARSER_PLUGIN_UNINSTALL - START");
+       PG_LOGD("PKGMGR_PARSER_PLUGIN_UNINSTALL() called.");
 
        if (packageId == NULL)
                return PRIV_GUARD_ERROR_INVALID_PARAMETER;
@@ -133,14 +134,14 @@ int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr docPtr, const char* packageId)
        int res = pInst->PgDeleteLogsByPackageId(std::string(packageId));
        if (res != PRIV_GUARD_ERROR_SUCCESS)
        {
-               LOGD("Failed to delete logs");
+               PG_LOGD("Failed to delete logs");
                return 0;
        }
 
        res = pInst->PgDeleteMonitorPolicyByPackageId(std::string(packageId));
        if (res != PRIV_GUARD_ERROR_SUCCESS)
        {
-               LOGD("Failed to delete monitor policy");
+               PG_LOGD("Failed to delete monitor policy");
        }
 
        return 0;
@@ -150,22 +151,22 @@ extern "C"
 __attribute__ ((visibility("default")))
 int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr docPtr, const char* packageId)
 {
-       LOGD("[STHAN] PKGMGR_PARSER_PLUGIN_UPGRADE - START");
+       PG_LOGD("PKGMGR_PARSER_PLUGIN_UPGRADE() called.");
 
        int res = 0;
 
-    LOGD("Update privacy Info");
+    PG_LOGD("Update privacy Info");
 
        res = PKGMGR_PARSER_PLUGIN_UNINSTALL(docPtr, packageId);
        if (res != 0)
        {
-               LOGD("Privacy info can be already uninstalled");
+               PG_LOGD("Privacy info can be already uninstalled");
        }
 
        res = PKGMGR_PARSER_PLUGIN_INSTALL(docPtr, packageId);
        if (res != 0)
        {
-               LOGD("Failed to install privacy Info: %d", res);
+               PG_LOGD("Failed to install privacy Info: %d", res);
        }
        return res;
 }
index 0edc96a..648e21d 100755 (executable)
@@ -23,8 +23,8 @@ do
     SQL=".read ${TZ_SYS_BIN}/"$name"_db.sql"
     sqlite3 ${TZ_SYS_DB}/.$name.db "$SQL"
     touch ${TZ_SYS_DB}/.$name.db-journal
-    chown root:root ${TZ_SYS_DB}/.$name.db
-    chown root:root ${TZ_SYS_DB}/.$name.db-journal
+    chown system:system ${TZ_SYS_DB}/.$name.db
+    chown system:system ${TZ_SYS_DB}/.$name.db-journal
     chmod 666 ${TZ_SYS_DB}/.$name.db
     chmod 666 ${TZ_SYS_DB}/.$name.db-journal
 done
index 14bb400..2d7fc9b 100755 (executable)
@@ -237,7 +237,7 @@ PrivacyGuardDb::PgAddPrivacyAccessLogTest(const int userId, const std::string pa
 int
 PrivacyGuardDb::PgAddMonitorPolicy(const int userId, const std::string packageId, const std::list < std::string > privacyList, bool monitorPolicy)
 {
-       LOGD("[STHAN] PgAddMonitorPolicy - START");
+       PG_LOGD("PrivacyGuardDb::PgAddMonitorPolicy");
 
        int res = -1;
 
index c500472..ba64dd9 100755 (executable)
@@ -54,8 +54,6 @@ PrivacyInfoService::PgAddPrivacyAccessLogTest(SocketConnection* pConnector)
 void
 PrivacyInfoService::PgAddMonitorPolicy(SocketConnection* pConnector)
 {
-       LOGD("[STHAN] PgAddMonitorPolicy - START");
-
        int userId = 0;
        std::string pkgId;
        std::list < std::string > list;