uh.removeApps.push_back(removeApp);
}
-void ServiceImpl::appUninstallCynaraPolicies(app_inst_req::app &app, app_inst_req &req,
+void ServiceImpl::appUninstallCynaraPolicies(std::string &processLabel, app_inst_req &req,
UninstallHelper &ui)
{
- std::string processLabel = getAppProcessLabel(app.appName, req.pkgName);
- LogDebug("Generated uninstall parameters: pkgName=" << req.pkgName
+ LogDebug("Removing Cynara policy for: pkgName=" << req.pkgName
<< " Smack label=" << processLabel);
bool global = req.installationType == SM_APP_INSTALL_GLOBAL ||
m_privilegeDb.GetPackagesInfo(uh.pkgsInfo);
getPkgsProcessLabels(uh.pkgsInfo, uh.pkgsProcessLabels);
+ LogDebug("Uninstalling pkg: " << req.pkgName << " with " << req.apps.size() << " apps");
+ for (auto &app: req.apps) {
+ LogDebug("-- Removing app: " << app.appName);
+ }
+
// [db] begin
ScopedTransaction trans(m_privilegeDb);
for (auto &app : req.apps) {
if (app.appName.empty())
continue;
+ // Cynara client (Smack label) needs to be calculated before we'll remove app from privileges db
+ // Otherwise, last app being removed from pkg will not be able to determine correct Smack label
+ // if the pkg is hybrid
+ std::string processLabel = getAppProcessLabel(app.appName, req.pkgName);
// [db] remove app
appUninstallPrivileges(app, req, uh);
// [cynara] update app policy
- appUninstallCynaraPolicies(app, req, uh);
+ appUninstallCynaraPolicies(processLabel, req, uh);
}
// [db] commit