{
return try_catch([&] {
LogDebug("security_manager_app_labels_monitor_init() called");
+ if (!smack_simple_check()) {
+ LogWarning("App label monitor disabled in no-smack mode");
+ return SECURITY_MANAGER_SUCCESS;
+ }
+
if (monitor == nullptr) {
LogWarning("Error input param \"monitor\"");
return SECURITY_MANAGER_ERROR_INPUT_PARAM;
{
(void)try_catch([&] {
LogDebug("security_manager_app_labels_monitor_finish() called");
+ if (!smack_simple_check()) {
+ LogWarning("App label monitor disabled in no-smack mode");
+ return SECURITY_MANAGER_SUCCESS;
+ }
+
if (monitor == nullptr) {
LogDebug("input param \"monitor\" is nullptr");
}
return try_catch([&] {
LogDebug("security_manager_app_labels_monitor_get_fd() called");
+ if (!smack_simple_check()) {
+ LogWarning("App label monitor disabled in no-smack mode");
+ return SECURITY_MANAGER_SUCCESS;
+ }
+
if (monitor == nullptr) {
LogWarning("Error input param \"monitor\"");
return SECURITY_MANAGER_ERROR_INPUT_PARAM;
{
return try_catch([&] {
LogDebug("security_manager_app_labels_process() called");
+ if (!smack_simple_check()) {
+ LogWarning("App label monitor disabled in no-smack mode");
+ return SECURITY_MANAGER_SUCCESS;
+ }
+
if (monitor == nullptr) {
LogWarning("Error input param \"monitor\"");
return SECURITY_MANAGER_ERROR_INPUT_PARAM;
Smack::Labels oldLabels;
- if (ih.isUserPkgInstalled)
+ if (smack_simple_check() && ih.isUserPkgInstalled)
getPkgLabels(req.pkgName, oldLabels);
// [db] begin
trans.commit();
LogDebug("Application installation commited to database");
- LogWarning("Configuring permissible file");
- Smack::Labels newLabels;
- getPkgLabels(req.pkgName, newLabels);
+ if (smack_simple_check()) {
+ LogWarning("Configuring permissible file");
+ Smack::Labels newLabels;
+ getPkgLabels(req.pkgName, newLabels);
- // update permissible set
- tryUpdatePermissibleFile(req.uid, req.installationType, newLabels, oldLabels);
+ // update permissible set
+ tryUpdatePermissibleFile(req.uid, req.installationType, newLabels, oldLabels);
+ }
// label paths
LogWarning("Configuring package paths");
if (ih.isUserPkgInstalled) {
LogWarning("Package already installed, need to remove some packages");
- getPkgLabels(req.pkgName, oldLabels);
+ if (smack_simple_check())
+ getPkgLabels(req.pkgName, oldLabels);
// search for installed apps in the request
std::vector<std::string> requestedApps;
for (auto &app : req.apps) {
trans.commit();
LogDebug("Application installation commited to database");
+ if (smack_simple_check()) {
+ Smack::Labels newLabels;
+ getPkgLabels(req.pkgName, newLabels);
- Smack::Labels newLabels;
- getPkgLabels(req.pkgName, newLabels);
-
- // update permissible set
- LogWarning("Configuring permissible file");
- tryUpdatePermissibleFile(req.uid, req.installationType, newLabels, oldLabels);
+ // update permissible set
+ LogWarning("Configuring permissible file");
+ tryUpdatePermissibleFile(req.uid, req.installationType, newLabels, oldLabels);
+ }
// label paths
LogWarning("Configuring package paths");
trans.commit();
LogDebug("Application uninstallation commited to database");
- Smack::Labels newLabels;
- if(!uh.removePkg)
- // only if we didn't remove entire pkg, some labels can stay
- // in the pkg only some apps could have been removed
- getPkgLabels(req.pkgName, newLabels);
+ if (smack_simple_check()) {
+ Smack::Labels newLabels;
+ if(!uh.removePkg)
+ // only if we didn't remove entire pkg, some labels can stay
+ // in the pkg only some apps could have been removed
+ getPkgLabels(req.pkgName, newLabels);
- // update permissible set
- tryUpdatePermissibleFile(req.uid, req.installationType, newLabels, oldLabels);
+ // update permissible set
+ tryUpdatePermissibleFile(req.uid, req.installationType, newLabels, oldLabels);
+ }
// remove and merge Smack rules for apps and pkg
return appUninstallSmackRules(req, uh);
int ServiceImpl::repairPermissibleFileForClient(uid_t uid, int installationType)
{
try {
+ if (!smack_simple_check()) {
+ LogWarning("Permissible file unsupported in no-smack mode");
+ return SECURITY_MANAGER_ERROR_SERVER_ERROR;
+ }
+
PermissibleSet::repairPermissibleFile(uid, installationType, m_privilegeDb);
}
catch (PermissibleSet::PermissibleSetException::Base &e){