diff options
author | WonYoung Choi <wy80.choi@samsung.com> | 2015-09-11 23:38:11 +0900 |
---|---|---|
committer | WonYoung Choi <wy80.choi@samsung.com> | 2015-09-11 23:38:11 +0900 |
commit | 1e2d9407f3823ced36e84aadb1cb635ebfde8595 (patch) | |
tree | 8b07563a37df0447ebf043798aca475c1e376d60 | |
parent | 134f0cdc623c2ad36aff65305d7daafae53fcabe (diff) | |
download | app-installers-tizen_3.0.m1_mobile.tar.gz app-installers-tizen_3.0.m1_mobile.tar.bz2 app-installers-tizen_3.0.m1_mobile.zip |
Sort privilege list before call security-manager function.tizen_3.0.m1_tv_releasetizen_3.0.m1_mobile_releasesubmit/tizen_common/20151026.085049submit/tizen_common/20151023.083358submit/tizen/20150911.145534accepted/tizen/wearable/20150911.150727accepted/tizen/tv/20150911.150722accepted/tizen/mobile/20150911.150711tizen_3.0.m1_tvtizen_3.0.m1_mobile
SecurityManager considers the privilege list is always sorted.
Change-Id: Ib5a9632e3d1d310d49aa55d29acca16ea4e3d670
-rw-r--r-- | src/common/security_registration.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/common/security_registration.cc b/src/common/security_registration.cc index aab8a670..fe0a1b12 100644 --- a/src/common/security_registration.cc +++ b/src/common/security_registration.cc @@ -9,6 +9,7 @@ #include <utility> #include <vector> +#include <algorithm> #include "common/utils/clist_helpers.h" #include "common/utils/logging.h" @@ -63,16 +64,25 @@ 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) { - security_manager_app_inst_req_add_privilege(req, priv->text); + priv_vec.push_back(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; } |