From 17bbe739bb6f01ce242cbeefda34371bcfecc014 Mon Sep 17 00:00:00 2001 From: Kyoungyong Lee Date: Wed, 13 Jul 2016 16:13:09 +0900 Subject: [PATCH] set the monitor default policy to 0 Change-Id: Ia7f190bfaf43000642997c616d8f41669b0f7361 --- pkgmgr_plugin/privileges.cpp | 2 +- server/src/CynaraService.cpp | 11 +++-------- server/src/PrivacyGuardDb.cpp | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/pkgmgr_plugin/privileges.cpp b/pkgmgr_plugin/privileges.cpp index d2e5315..4609698 100755 --- a/pkgmgr_plugin/privileges.cpp +++ b/pkgmgr_plugin/privileges.cpp @@ -25,7 +25,7 @@ #include "privacy_guard_client_internal.h" #include "PrivacyGuardClient.h" -#define DEFAULT_MONITOR_POLICY 1 +#define DEFAULT_MONITOR_POLICY 0 static const xmlChar _NODE_PRIVILEGES[] = "privileges"; static const xmlChar _NODE_PRIVILEGE[] = "privilege"; diff --git a/server/src/CynaraService.cpp b/server/src/CynaraService.cpp index 5255a97..f649180 100755 --- a/server/src/CynaraService.cpp +++ b/server/src/CynaraService.cpp @@ -213,7 +213,7 @@ CynaraService::updateDb(cynara_monitor_entry **monitor_entries) // check app ID std::string tempAppId = client; - PG_LOGD("App ID from cynara: [%s]", client); + //PG_LOGD("App ID from cynara: [%s]", client); if (tempAppId.substr(0, USER_APP_PREFIX_LEN).compare(USER_APP_PREFIX) == 0) { appId = tempAppId.substr(USER_APP_PREFIX_LEN, tempAppId.length() - USER_APP_PREFIX_LEN); PG_LOGD("App ID: [%s]", appId.c_str()); @@ -224,7 +224,6 @@ CynaraService::updateDb(cynara_monitor_entry **monitor_entries) // get package ID from app ID pkgmgrinfo_appinfo_h pkgmgrinfo_appinfo; - PG_LOGD("User ID: [%d], Global User ID: [%d]", userId, GLOBAL_USER); if (userId == GLOBAL_USER) { res = pkgmgrinfo_appinfo_get_appinfo(appId.c_str(), &pkgmgrinfo_appinfo); } else { @@ -239,7 +238,7 @@ CynaraService::updateDb(cynara_monitor_entry **monitor_entries) PG_LOGE("Failed to do pkgmgrinfo_appinfo_get_pkgname [%d] for the app [%s]. So set the package ID to app ID.", res, appId.c_str()); packageId = appId; } - PG_LOGD("Package ID of [%s] is [%s]", appId.c_str(), package_id); + //PG_LOGD("Package ID of [%s] is [%s]", appId.c_str(), package_id); package_id_dup = strdup(package_id); packageId = package_id_dup; pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo); @@ -259,7 +258,6 @@ CynaraService::updateDb(cynara_monitor_entry **monitor_entries) PG_LOGE("Failed to do pkgmgrinfo_pkginfo_is_global [%d]", res); } else { if (is_global == true) { - PG_LOGD("[%s] is a global app. So set the user_id to 0.", packageId.c_str()); userId = GLOBAL_APP_USER_ID; } } @@ -271,10 +269,7 @@ CynaraService::updateDb(cynara_monitor_entry **monitor_entries) // add access log int ret = PrivacyGuardDb::getInstance()->PgAddPrivacyAccessLogForCynara(userId, packageId, privacyId, date); - if(ret == PRIV_GUARD_ERROR_SUCCESS){ - PG_LOGD("Succeeded to add access log to DB. UserID:[%d], PackageID:[%s], Privacy:[%s]", userId, packageId.c_str(), privacyId.c_str()); - } - else{ + if(ret != PRIV_GUARD_ERROR_SUCCESS){ PG_LOGE("Failed to add access log to DB. UserID:[%d], PackageID:[%s], Privacy:[%s]", userId, packageId.c_str(), privacyId.c_str()); } } diff --git a/server/src/PrivacyGuardDb.cpp b/server/src/PrivacyGuardDb.cpp index dd60f8b..af86fb0 100755 --- a/server/src/PrivacyGuardDb.cpp +++ b/server/src/PrivacyGuardDb.cpp @@ -96,7 +96,7 @@ PrivacyGuardDb::PgAddPrivacyAccessLogForCynara(const int userId, const std::stri res = PgGetMonitorPolicy(userId, packageId, privacyId, monitorPolicy); TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, , "PgGetMonitorPolicy is failed: [%d]", res); if (monitorPolicy == 0) { - PG_LOGD("Monitor Policy is 0. So skip it. UserId:[%d], PrivacyId:[%s], PackageId:[%s], Policy:[%d]", userId, privacyId.c_str(), packageId.c_str(), monitorPolicy); + //PG_LOGD("Monitor Policy is 0. So skip it. UserId:[%d], PrivacyId:[%s], PackageId:[%s], Policy:[%d]", userId, privacyId.c_str(), packageId.c_str(), monitorPolicy); return PRIV_GUARD_ERROR_SUCCESS; } -- 2.7.4