Move pkgmgr dep from client package to server 57/156257/1 submit/tizen_4.0/20171018.012101
authortizen <s.moraes@samsung.com>
Tue, 17 Oct 2017 20:13:28 +0000 (18:13 -0200)
committertizen <s.moraes@samsung.com>
Tue, 17 Oct 2017 20:13:39 +0000 (18:13 -0200)
Change-Id: Ie44995595dfade61d64e91b4a81cabd36c18c909
Signed-off-by: tizen <s.moraes@samsung.com>
client/CMakeLists.txt
client/inc/PrivacyGuardClient.h
client/src/DlpLogsManager.cpp
client/src/PrivacyGuardClient.cpp
common/inc/PrivacyGuardTypes.h
common/inc/SocketConnection.h
server/inc/DlpRuleChangeNotification.h
server/inc/PrivacyGuardDb.h
server/src/DlpRuleChangeNotification.cpp
server/src/PrivacyGuardDb.cpp
server/src/service/PrivacyInfoService.cpp

index 482a23831830301419a96567d0a9816cbf58cb33..d09fd5ab2237c487424f4a4201ee69dc08ed91b5 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 pkgmgr-info libtzplatform-config libpcre)
+pkg_check_modules(privacy-guard-client REQUIRED dlog sqlite3 dbus-1 dbus-glib-1 db-util libtzplatform-config libpcre)
 
 FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
@@ -99,3 +99,4 @@ INSTALL(TARGETS privacy-guard-client DESTINATION ${LIB_INSTALL_DIR} COMPONENT Ru
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/privacy-guard-client.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 INSTALL(FILES ${PRIVACY_GUARD_CLIENT_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/privacy_guard/client)
 INSTALL(FILES ${PRIVACY_GUARD_EXTERN_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/privacy_guard)
+
index 66641dddc93fa4d060d3463424be8c670ad6f811..a8a5cdd4fdc0f13827e3981563bdee653423de93 100644 (file)
@@ -36,11 +36,6 @@ std::mutex m_dbMutex;
 sqlite3* m_sqlHandler;
 sqlite3_stmt* m_stmt;
 bool m_bDBOpen;
-char m_applicationId[LEN_APPLICATION_ID] = { 0 };
-char m_applicationName[LEN_APPLICATION_NAME] = { 0 };
-char m_applicationVersion[LEN_APPLICATION_VERSION] = { 0 };
-char m_applicationIcon[LEN_APPLICATION_ICON] = { 0 };
-char m_packageId[LEN_PACKAGE_ID] = { 0 };
 
 static PrivacyGuardClient* m_pInstance;
 static const std::string INTERFACE_NAME;
@@ -108,6 +103,7 @@ int PgUpdateMainMonitorPolicy(const int userId, const int mainMonitorPolicy);
  * @brief      add a list of leak logs to the database
  *
  * @param[in]  userId                  The ID of the user running the application 
+ * @param[in]  pId                             The process ID of the application
  * @param[in]  destination             The host which the data is to be sent to
  * @param[in]  rawPacket               The data packet to be sent
  * @param[in]  len                             The length of the packet data in bytes
@@ -116,7 +112,7 @@ int PgUpdateMainMonitorPolicy(const int userId, const int mainMonitorPolicy);
  * @return     An error code
  * @since      Tizen 4.0
  */
-int PgAddLeakLog(const int userId, const char *destination, const void *rawPacket, const size_t len, const std::list<leak_log_insert_data_s> &logList) const;
+int PgAddLeakLog(const int userId, const int pId, const char *destination, const void *rawPacket, const size_t len, const std::list<leak_log_insert_data_s> &logList) const;
 
 /**
  * @brief      get all logs from leaked packets.
@@ -349,3 +345,4 @@ int PgForeachDlpCategories(std::list<std::string> &categories) const;
 };
 
 #endif // _PRIVACYGUARDCLIENT_H_
+
index e8b71c60a82e97fb1bb0d07cd494cc847db8c52b..0a9429822323a6951f46dd688bb8a18290927843 100644 (file)
@@ -121,6 +121,7 @@ DlpLogsManager::LeakLogSendThreadFunc(void *_this)
 void*
 DlpLogsManager::LeakLogSendThread()
 {
+       uid_t pid = getpid();
        uid_t uid = getuid();
 
        for (;;) {
@@ -129,13 +130,16 @@ DlpLogsManager::LeakLogSendThread()
 
                // with new entries, try to process them
                m_logQueueMutex.lock();
-               for (auto &it : m_logQueue) {
+               for (auto it = m_logQueue.begin(); it != m_logQueue.end(); it++) {
+                       m_logQueueMutex.unlock();
                        // if packet has not been parsed yet, parse now
-                       if (!it.rlist.empty())
-                               ParseAndLogLeakNow(it);
+                       if (!it->rlist.empty())
+                               ParseAndLogLeakNow(*it);
 
-                       if (!it.llist.empty())
-                               m_privacyGuardClient->PgAddLeakLog(uid, it.hostname.c_str(), it.mem, it.len, it.llist);
+                       if (!it->llist.empty())
+                               m_privacyGuardClient->PgAddLeakLog(uid, pid, it->hostname.c_str(), it->mem, it->len, it->llist);
+
+                       m_logQueueMutex.lock();
                }
 
                // all entries processed, call clear destroying each element from queue
@@ -144,3 +148,4 @@ DlpLogsManager::LeakLogSendThread()
        }
        return NULL;
 }
+
index 55d0902550ed29b386862682713363589278fd8d..0801986962106f3b82dc8f6c604ea3633f2f5567 100644 (file)
@@ -18,8 +18,6 @@
 #include <memory>
 #include <fcntl.h>
 #include <strings.h>
-#include <aul.h>
-#include <pkgmgr-info.h>
 #include "Utils.h"
 #include "DlpUtils.h"
 #include "PrivacyGuardClient.h"
@@ -36,7 +34,6 @@ char PrivacyGuardClient::m_categories[MAX_CATEGORIES][LEN_CATEGORY];
 
 PrivacyGuardClient::PrivacyGuardClient(void):m_sqlHandler(NULL), m_stmt(NULL), m_bDBOpen(false)
 {
-       loadApplicationInfo();
        int res = loadDlpCategories();
        if (res != PRIV_GUARD_ERROR_SUCCESS) {
                PG_LOGE("fail : loadDlpCategories (%d)", res);
@@ -60,51 +57,6 @@ PrivacyGuardClient::category_text_to_id(const char *txt)
   return -1;
 }
 
-void
-PrivacyGuardClient::loadApplicationInfo()
-{
-       int ret;
-       char *data = NULL;
-       pkgmgrinfo_appinfo_h appinfo = NULL;
-       pkgmgrinfo_pkginfo_h pkginfo = NULL;
-
-       // load application ID
-       ret = aul_app_get_appid_bypid(getpid(), m_applicationId, LEN_APPLICATION_ID);
-       if (ret == 0) {
-               // load application info
-               ret = pkgmgrinfo_appinfo_get_usr_appinfo(m_applicationId, getuid(), &appinfo);
-               if (ret == 0) {
-                       // load application name
-                       ret = pkgmgrinfo_appinfo_get_label(appinfo, &data);
-                       if (ret == 0)
-                               pg_strlcpy(m_applicationName, data, LEN_APPLICATION_NAME);
-
-                       // load package ID
-                       ret = pkgmgrinfo_appinfo_get_pkgid(appinfo, &data);
-                       if (ret == 0)
-                               pg_strlcpy(m_packageId, data, LEN_PACKAGE_ID);
-
-                       // load application icon
-                       ret = pkgmgrinfo_appinfo_get_icon(appinfo, &data);
-                       if (ret == 0)
-                               pg_strlcpy(m_applicationIcon, data, LEN_APPLICATION_ICON);
-
-                       // load package info
-                       ret = pkgmgrinfo_pkginfo_get_pkginfo(m_packageId, &pkginfo);
-                       if (ret == 0) {
-                               // load application version
-                               ret = pkgmgrinfo_pkginfo_get_version(pkginfo, &data);
-                               if (ret == 0)
-                                       pg_strlcpy(m_applicationVersion, data, LEN_APPLICATION_VERSION);
-
-                               pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo);
-                       }
-
-                       pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
-               }
-       }
-}
-
 /**
  * @callgraph
  */
@@ -600,7 +552,7 @@ PrivacyGuardClient::PgUpdateMainMonitorPolicy(const int userId, const int mainMo
  * @callgraph
  */
 int
-PrivacyGuardClient::PgAddLeakLog(const int userId, const char *destination, const void *rawPacket, const size_t len, const std::list<leak_log_insert_data_s> &logList) const
+PrivacyGuardClient::PgAddLeakLog(const int userId, const int pId, const char *destination, const void *rawPacket, const size_t len, const std::list<leak_log_insert_data_s> &logList) const
 {
        if (destination == NULL || rawPacket == NULL)
                return PRIV_GUARD_ERROR_INVALID_PARAMETER;
@@ -612,10 +564,7 @@ PrivacyGuardClient::PgAddLeakLog(const int userId, const char *destination, cons
        int res = socketClient.connect();
        TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, , "connect : %d", res);
 
-       res = socketClient.call("PgAddLeakLog", userId, (const char *)m_applicationId,
-                                                               (const char *)m_applicationName, (const char *)m_applicationVersion,
-                                                               (const char *)m_applicationIcon, (const char *)m_packageId,
-                                                               destination, packetData, logList, &result);
+       res = socketClient.call("PgAddLeakLog", userId, pId, destination, packetData, logList, &result);
        TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, socketClient.disconnect(), "call : %d", res);
 
        res = socketClient.disconnect();
@@ -848,8 +797,7 @@ PrivacyGuardClient::PgGetDlpCurrentRules(const int userId, const int pId, std::l
        TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, , "connect : %d", res);
 
        currentRules.clear();
-       res = socketClient.call("PgGetDlpCurrentRules", userId, (const char *)m_applicationId,
-                                                               pId, &result, &currentRules);
+       res = socketClient.call("PgGetDlpCurrentRules", userId, pId, &result, &currentRules);
        TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, socketClient.disconnect(), "call : %d", res);
 
        res = socketClient.disconnect();
@@ -1055,3 +1003,4 @@ PrivacyGuardClient::PgForeachDlpCategories(std::list<std::string> &categories) c
        }
        return result;
 }
+
index a2bb71a24f321595d882c9f05128ee20e302c118..cd1425a11932bb0447db76140f9cc3ef45dc577e 100644 (file)
@@ -68,11 +68,7 @@ typedef struct _packet_data_s {
 
 typedef struct _leak_log_insert_common_data_s {
        int user_id;
-       char application_id[LEN_APPLICATION_ID];
-       char application_name[LEN_APPLICATION_NAME];
-       char application_version[LEN_APPLICATION_VERSION];
-       char application_icon[LEN_APPLICATION_ICON];
-       char package_id[LEN_PACKAGE_ID];
+       int pid;
        char destination[LEN_DESTINATION];
        packet_data_s pkt_data;
 } leak_log_insert_common_data_s;
@@ -94,9 +90,18 @@ typedef struct _current_rules_s {
 
 typedef std::list<current_rules_s> current_rules_list;
 
+typedef struct _privacy_semaphore_app_info_s {
+       char application_id[LEN_APPLICATION_ID];
+       char application_name[LEN_APPLICATION_NAME];
+       char application_version[LEN_APPLICATION_VERSION];
+       char application_icon[LEN_APPLICATION_ICON];
+       char package_id[LEN_PACKAGE_ID];
+} privacy_semaphore_app_info_s;
+
 typedef struct _privacy_semaphore_s {
        int pid;
        sem_t *sem;
+       privacy_semaphore_app_info_s app_info;
 } privacy_semaphore_s;
 
 typedef struct _custom_rule_s {
@@ -115,3 +120,4 @@ static const std::string DBUS_SIGNAL_SETTING_CHANGED("privacy_setting_changed");
 static const std::string DBUS_SIGNAL_PKG_REMOVED("privacy_pkg_removed");
 
 #endif // _PRIVACYGUARDTYPES_H_
+
index 63c8bc880eb3f7cd9f9248f8faa86dc8a788aed0..eb827238de08f83d69c668d397a86b45d2a9e694 100755 (executable)
@@ -445,24 +445,8 @@ public:
                int res = read(&out.user_id);
                TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, , "read : %d", res);
 
-               // application ID
-               res = read(out.application_id, LEN_APPLICATION_ID);
-               TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, , "read : %d", res);
-
-               // application name
-               res = read(out.application_name, LEN_APPLICATION_NAME);
-               TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, , "read : %d", res);
-
-               // application version
-               res = read(out.application_version, LEN_APPLICATION_VERSION);
-               TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, , "read : %d", res);
-
-               // application icon
-               res = read(out.application_icon, LEN_APPLICATION_ICON);
-               TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, , "read : %d", res);
-
-               // package ID
-               res = read(out.package_id, LEN_PACKAGE_ID);
+               // pid
+               res = read(&out.pid);
                TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, , "read : %d", res);
 
                // destination
@@ -1251,3 +1235,4 @@ private:
 };
 
 #endif // _SOCKETCONNECTION_H_
+
index a121f0de4b45ce8dbf060fa445d31e1055d22653..1e37b922f6451ad7bcc276b839d9bc63b455fcb3 100644 (file)
@@ -41,11 +41,22 @@ public:
        /**
         * @brief add a new client to list of clients to inform about rule changes
         * @param[in] pId                       The process id of the client to be added
+        * @param[in] userId            The user id of the client to be added
         *
         * @return the result of operation (ERRORCODE : success, ....)
         * @since Tizen 3.0
         */
-       int addDlpClient(int pId);
+       int addDlpClient(int pId, int userId, char **appId);
+
+       /**
+        * @brief get the application info for the pid
+        * @param[in] pId                       The process id of the client look of info
+        * @param[out] pId                      The privacy_semaphore_app_info_s struct related to pid
+        *
+        * @return the result of operation (ERRORCODE : success, ....)
+        * @since Tizen 3.0
+        */
+        int getAppInfo(int pId, privacy_semaphore_app_info_s **app_info);
 
        /**
         * @brief send notification to all registered clients that a rule may have changed
@@ -57,3 +68,4 @@ public:
 };
 
 #endif // _DLP_RULECHANGENOTIFICATION_H_
+
index a6375236ac62102b4f42b9f949eda9436bf8d588..647ac76326ef1ed99a89b66dc74ae3ee7584396e 100755 (executable)
@@ -223,14 +223,13 @@ public:
        /**
         * @brief get the list of current rules
         * @param[in] userId                            The user ID to get the rules for
-        * @param[in] AppId                             The application name (or empty string)
         * @param[in] pId                               The process ID, to be added to the list of rule change notification clients
         * @param[out] rules                            The rules which were retrieved
         *
         * @return the result of operation (ERRORCODE : success, ....)
         * @since Tizen 4.0
         */
-       int PgGetDlpCurrentRules(const int userId, const char *AppId, const int pId, std::list<current_rules_s> &rules);
+       int PgGetDlpCurrentRules(const int userId, const int pId, std::list<current_rules_s> &rules);
 
        /**
         * @brief retrieve the list of email addresses for the specified user
@@ -330,3 +329,4 @@ public:
 
 
 #endif // _PRIVACY_GUARD_DB_H_
+
index 99c16ccf58db1808b8d40729576abf879753163d..4dcfe50cfc7568d86b00e6e853dd363734f6654a 100644 (file)
@@ -23,6 +23,8 @@
 #include <sys/types.h>
 #include <signal.h>
 #include <errno.h>
+#include <aul.h>
+#include <pkgmgr-info.h>
 #include "DlpRuleChangeNotification.h"
 #include "Utils.h"
 
@@ -42,7 +44,7 @@ DlpRuleChangeNotification::getInstance(void)
 }
 
 int
-DlpRuleChangeNotification::addDlpClient(int pId)
+DlpRuleChangeNotification::addDlpClient(int pId, int userId, char **appId)
 {
        int res = PRIV_GUARD_ERROR_SUCCESS;
        bool first_request_by_pid = true;
@@ -54,6 +56,7 @@ DlpRuleChangeNotification::addDlpClient(int pId)
                if (it->pid == pId) {
                        // Process found, no need to add it to sem list
                        first_request_by_pid = false;
+                       *appId = it->app_info.application_id;
                } else {
                        // Just checking if the process still exists, no signal is sent
                        if (kill(it->pid, 0) == -1 && errno == ESRCH) {
@@ -70,6 +73,48 @@ DlpRuleChangeNotification::addDlpClient(int pId)
                // First request from process, to add it to sem list
                snprintf(sem_name, sizeof(PRIVACY_SEM_INITVAL)+5, PRIVACY_SEM_INITVAL, pId);
                privacy_semaphore_s ps;
+               pkgmgrinfo_appinfo_h appinfo = NULL;
+               pkgmgrinfo_pkginfo_h pkginfo = NULL;
+               char *data = NULL;
+
+               // load application ID
+               ps.app_info.application_id[0] = 0;
+               *appId = ps.app_info.application_id;
+               int ret = aul_app_get_appid_bypid(pId, ps.app_info.application_id, LEN_APPLICATION_ID);
+               if (ret == 0) {
+                       // load application info
+                       ret = pkgmgrinfo_appinfo_get_usr_appinfo(ps.app_info.application_id, userId, &appinfo);
+                       if (ret == 0) {
+                               // load application name
+                               ret = pkgmgrinfo_appinfo_get_label(appinfo, &data);
+                               if (ret == 0)
+                                       pg_strlcpy(ps.app_info.application_name, data, LEN_APPLICATION_NAME);
+
+                               // load package ID
+                               ret = pkgmgrinfo_appinfo_get_pkgid(appinfo, &data);
+                               if (ret == 0)
+                                       pg_strlcpy(ps.app_info.package_id, data, LEN_PACKAGE_ID);
+
+                               // load application icon
+                               ret = pkgmgrinfo_appinfo_get_icon(appinfo, &data);
+                               if (ret == 0)
+                                       pg_strlcpy(ps.app_info.application_icon, data, LEN_APPLICATION_ICON);
+
+                               // load package info
+                               ret = pkgmgrinfo_pkginfo_get_pkginfo(ps.app_info.package_id, &pkginfo);
+                               if (ret == 0) {
+                                       // load application version
+                                       ret = pkgmgrinfo_pkginfo_get_version(pkginfo, &data);
+                                       if (ret == 0)
+                                               pg_strlcpy(ps.app_info.application_version, data, LEN_APPLICATION_VERSION);
+
+                                       pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo);
+                               }
+
+                               pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
+                       }
+               }
+
                ps.sem = sem_open(sem_name, 0);
                if (ps.sem == SEM_FAILED) {
                        PG_LOGE("errro opening sem: %s  - %s", sem_name, strerror_r(errno, buf, sizeof(buf)));
@@ -83,6 +128,17 @@ DlpRuleChangeNotification::addDlpClient(int pId)
        return res;
 }
 
+int
+DlpRuleChangeNotification::getAppInfo(int pId, privacy_semaphore_app_info_s **app_info) {
+       for (auto &it: m_semaphore_list) {
+               if (it.pid == pId) {
+                       *app_info = &(it.app_info);
+                       return PRIV_GUARD_ERROR_SUCCESS;
+               }
+       }
+       return PRIV_GUARD_ERROR_NO_DATA;
+}
+
 int
 DlpRuleChangeNotification::notifyDlpClients()
 {
@@ -109,3 +165,4 @@ DlpRuleChangeNotification::notifyDlpClients()
 
        return res;
 }
+
index 02efe5cf092b862ca936a55babef888cbdb2c609..919edf0743beb1498042b254219060d8c86e7360 100644 (file)
@@ -1578,6 +1578,11 @@ PrivacyGuardDb::PgAddLeakLog(leak_log_insert_common_data_s &data, const std::lis
        const char *insertl = "INSERT INTO DlpLeakLog(REQUEST_ID, PATTERN_ID, ACTION, LEAK_OFFSET, LEAK_LEN) "
                              "VALUES(?, ?, ?, ?, ?)";
 
+       privacy_semaphore_app_info_s *app_info;
+       if(DlpRuleChangeNotification::getInstance() == NULL || PRIV_GUARD_ERROR_SUCCESS !=
+               DlpRuleChangeNotification::getInstance()->getAppInfo(data.pid, &app_info))
+               return PRIV_GUARD_ERROR_DB_ERROR;
+
        m_dbMutex.lock();
 
        // initialize
@@ -1604,19 +1609,19 @@ PrivacyGuardDb::PgAddLeakLog(leak_log_insert_common_data_s &data, const std::lis
        res = sqlite3_bind_int(m_stmt, 2, time(NULL));
        TryCatchResLogReturn(res == SQLITE_OK, sqlite3_finalize(m_stmt); m_dbMutex.unlock(), PRIV_GUARD_ERROR_DB_ERROR, "sqlite3_bind_int : %d", res);
 
-       res = sqlite3_bind_text(m_stmt, 3, data.application_name, -1, SQLITE_TRANSIENT);
+       res = sqlite3_bind_text(m_stmt, 3, app_info->application_name, -1, SQLITE_TRANSIENT);
        TryCatchResLogReturn(res == SQLITE_OK, sqlite3_finalize(m_stmt); m_dbMutex.unlock(), PRIV_GUARD_ERROR_DB_ERROR, "sqlite3_bind_text : %d", res);
 
-       res = sqlite3_bind_text(m_stmt, 4, data.application_icon, -1, SQLITE_TRANSIENT);
+       res = sqlite3_bind_text(m_stmt, 4, app_info->application_icon, -1, SQLITE_TRANSIENT);
        TryCatchResLogReturn(res == SQLITE_OK, sqlite3_finalize(m_stmt); m_dbMutex.unlock(), PRIV_GUARD_ERROR_DB_ERROR, "sqlite3_bind_text : %d", res);
 
-       res = sqlite3_bind_text(m_stmt, 5, data.application_id, -1, SQLITE_TRANSIENT);
+       res = sqlite3_bind_text(m_stmt, 5, app_info->application_id, -1, SQLITE_TRANSIENT);
        TryCatchResLogReturn(res == SQLITE_OK, sqlite3_finalize(m_stmt); m_dbMutex.unlock(), PRIV_GUARD_ERROR_DB_ERROR, "sqlite3_bind_text : %d", res);
 
-       res = sqlite3_bind_text(m_stmt, 6, data.application_version, -1, SQLITE_TRANSIENT);
+       res = sqlite3_bind_text(m_stmt, 6, app_info->application_version, -1, SQLITE_TRANSIENT);
        TryCatchResLogReturn(res == SQLITE_OK, sqlite3_finalize(m_stmt); m_dbMutex.unlock(), PRIV_GUARD_ERROR_DB_ERROR, "sqlite3_bind_text : %d", res);
 
-       res = sqlite3_bind_text(m_stmt, 7, data.package_id, -1, SQLITE_TRANSIENT);
+       res = sqlite3_bind_text(m_stmt, 7, app_info->package_id, -1, SQLITE_TRANSIENT);
        TryCatchResLogReturn(res == SQLITE_OK, sqlite3_finalize(m_stmt); m_dbMutex.unlock(), PRIV_GUARD_ERROR_DB_ERROR, "sqlite3_bind_text : %d", res);
 
        res = sqlite3_bind_text(m_stmt, 8, data.destination, -1, SQLITE_TRANSIENT);
@@ -2353,14 +2358,17 @@ PrivacyGuardDb::PgGetDlpProfile(const int userId, dlp_profile_s &profile)
 }
 
 int
-PrivacyGuardDb::PgGetDlpCurrentRules(const int userId, const char *appId, const int pId, std::list<current_rules_s> &rules)
+PrivacyGuardDb::PgGetDlpCurrentRules(const int userId, const int pId, std::list<current_rules_s> &rules)
 {
        int res = -1;
        char query[256];
+       char *appId;
        dlp_profile_s profile;
 
        if(DlpRuleChangeNotification::getInstance() != NULL)
-               DlpRuleChangeNotification::getInstance()->addDlpClient(pId);
+               DlpRuleChangeNotification::getInstance()->addDlpClient(pId, userId, &appId);
+       else
+               return PRIV_GUARD_ERROR_DB_ERROR;
 
        // get current profile
        PgGetDlpProfile(userId, profile);
@@ -3136,3 +3144,4 @@ PrivacyGuardDb::getInstance(void)
 
        return m_pInstance;
 }
+
index b0fcc37d2175119763221611ee5a28d0047543a4..8877be941b12072ae906d803003af3276119020c 100755 (executable)
@@ -486,16 +486,14 @@ void
 PrivacyInfoService::PgGetDlpCurrentRules(SocketConnection* pConnector)
 {
        int userId = 0;
-       char appId[LEN_PACKAGE_ID];
        int pId = 0;
        std::list<current_rules_s> templateRules;
        std::list<current_rules_s> rules;
 
        pConnector->read(&userId);
-       pConnector->read(appId, LEN_PACKAGE_ID);
        pConnector->read(&pId);
 
-       int result = PrivacyGuardDb::getInstance()->PgGetDlpCurrentRules(userId, appId, pId, templateRules);
+       int result = PrivacyGuardDb::getInstance()->PgGetDlpCurrentRules(userId, pId, templateRules);
 
        // replace all rule templates
        if (result == PRIV_GUARD_ERROR_SUCCESS)
@@ -615,3 +613,4 @@ PrivacyInfoService::PgGetDlpCategories(SocketConnection* pConnector)
 
        pConnector->write(result, categories);
 }
+