Translate app name to pkg name when getting sensitive dirs 09/117309/2
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Fri, 3 Mar 2017 14:45:32 +0000 (15:45 +0100)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 6 Mar 2017 15:46:36 +0000 (16:46 +0100)
Change-Id: I43ad754981f883ed11214f2193f8ca41f8e79eea

src/common/include/service_impl.h
src/common/service_impl.cpp

index 00338a2b58f301355f00a2d104d48385b7301960..3566527bdea06eb5cd87c9458873b1340b038047 100644 (file)
@@ -253,13 +253,13 @@ public:
      * Retrieve a list of sensitive directories for given package
      *
      * @param[in] creds credentials of the requesting process
-     * @param[in] pkgName package identifier
+     * @param[in] appName application identifier
      * @param[out] paths vector of paths to sensitive directories
      *
      * @return API return code, as defined in protocols.h
      */
     int getSensitiveDirs(const Credentials &creds,
-                         const std::string &pkgName,
+                         const std::string &appName,
                          std::vector<std::string> &paths);
 private:
     bool authenticate(const Credentials &creds, const std::string &privilege);
index fa36961e739041f819586255ff1e3889dd266488..f93c0fddfe5a5f5441724173b9c11abd3b3c95d4 100644 (file)
@@ -1732,7 +1732,7 @@ int ServiceImpl::shmAppName(const Credentials &creds, const std::string &shmName
 }
 
 int ServiceImpl::getSensitiveDirs(const Credentials &creds,
-                                  const std::string &pkgName,
+                                  const std::string &appName,
                                   std::vector<std::string> &paths)
 {
     try {
@@ -1745,6 +1745,9 @@ int ServiceImpl::getSensitiveDirs(const Credentials &creds,
 
         ScopedTransaction trans(m_priviligeDb);
 
+        std::string pkgName;
+        m_priviligeDb.GetAppPkgName(appName, pkgName);
+
         if(!m_priviligeDb.PkgNameExists(pkgName)) {
             LogError("Package " << pkgName << " does not exist");
             return SECURITY_MANAGER_ERROR_INPUT_PARAM;