#include <config.h>
#include <utils.h>
#include <privilege-info.h>
+#include <security-manager-types.h>
#include <lm-config.h>
namespace SecurityManager {
}
}
+ // installer adds these privilege(s) to each applications' manifest data at install stage
+ // to indicate cert-level; privilege checker will need this information to check privilege
+ // attribute
+ std::map<std::string, int> appToCertLevel;
+ for (CynaraAdminPolicy &policy : appPolicies) {
+ std::string appName(policy.client);
+ if (appToCertLevel.find(appName) == appToCertLevel.end())
+ appToCertLevel[appName] = SM_PKG_PRIVILEGE_LEVEL_NONE;
+ if (strcmp(policy.privilege, "http://tizen.org/privilege/internal/default/public") == 0)
+ appToCertLevel[appName] = max(appToCertLevel[appName], SM_PKG_PRIVILEGE_LEVEL_PUBLIC);
+ else if (strcmp(policy.privilege, "http://tizen.org/privilege/internal/default/partner") == 0)
+ appToCertLevel[appName] = max(appToCertLevel[appName], SM_PKG_PRIVILEGE_LEVEL_PARTNER);
+ else if (strcmp(policy.privilege, "http://tizen.org/privilege/internal/default/platform") == 0)
+ appToCertLevel[appName] = SM_PKG_PRIVILEGE_LEVEL_PLATFORM;
+ }
+
// for each global app: retrieve its privacy-related abnd blacklist privileges and set
// their policy in PRIVACY_MANAGER bucket accordingly
for (CynaraAdminPolicy &policy : appPolicies) {
try {
- PrivilegeInfo priv(uid, policy.client, policy.privilege);
+ PrivilegeInfo priv(uid, policy.client, policy.privilege,
+ SM_PKG_TYPE_NONE,
+ appToCertLevel[policy.client]);
if (askUserEnabled && priv.hasAttribute(PrivilegeInfo::PrivilegeAttr::PRIVACY))
policies.push_back(CynaraAdminPolicy(
policy.client,