#include <utility>
#include <vector>
+#include <algorithm>
#include "common/utils/clist_helpers.h"
#include "common/utils/logging.h"
}
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;
}