Remove sorting of privileges for security_manager 84/49884/2
authorTomasz Iwanek <t.iwanek@samsung.com>
Wed, 21 Oct 2015 07:10:38 +0000 (09:10 +0200)
committerPawel Sikorski <p.sikorski@samsung.com>
Fri, 23 Oct 2015 14:17:17 +0000 (07:17 -0700)
According to security team, sorting is not needed:

 "This requirement is now removed. You can safely call
  security_manager_app_inst_req_add_privilege in
  arbitrary order and even with duplicates"

Change-Id: I19b1300e5558832d362ae538a354f1018674cb26

src/common/security_registration.cc

index 06cb954..f62481d 100644 (file)
@@ -64,23 +64,15 @@ bool PrepareRequest(const std::string& app_id, const std::string& pkg_id,
   }
 
   if (manifest) {
-    std::vector<std::string> priv_vec;
-
     privileges_x *privileges = nullptr;
     PKGMGR_LIST_MOVE_NODE_TO_HEAD(manifest->privileges, privileges);
     for (; privileges != nullptr; privileges = privileges->next) {
       privilege_x* priv = nullptr;
       PKGMGR_LIST_MOVE_NODE_TO_HEAD(privileges->privilege, priv);
       for (; priv != nullptr; priv = priv->next) {
-        priv_vec.push_back(priv->text);
+        security_manager_app_inst_req_add_privilege(req, priv->text);
       }
     }
-
-    // privileges should be sorted.
-    std::sort(priv_vec.begin(), priv_vec.end());
-    for (auto& priv : priv_vec) {
-      security_manager_app_inst_req_add_privilege(req, priv.c_str());
-    }
   }
 
   return true;