Add smackfs check to Installer service. 69/22669/2
authorMarcin Lis <m.lis@samsung.com>
Mon, 9 Jun 2014 15:55:09 +0000 (17:55 +0200)
committerMarcin Lis <m.lis@samsung.com>
Tue, 10 Jun 2014 08:46:51 +0000 (10:46 +0200)
The app installation was failing under the non-smack environment.
One additional check for the existence of the smack is now added to
prevent the Installer from applying smack rules to the kernel, when
there is no smack security enabled.

The same kind of check is also added to uninstall-app functionality.

Change-Id: I9ed29e7d60e34639173317ac83c1f5314100d6e4
Signed-off-by: Marcin Lis <m.lis@samsung.com>
src/server/service/smack-rules.cpp

index 24e9add..4319ca9 100644 (file)
@@ -226,7 +226,7 @@ bool SmackRules::installPackageRules(const std::string &pkgId) {
              return false;
          }
 
-         if (!smackRules.apply()) {
+         if (smack_smackfs_path() != NULL && !smackRules.apply()) {
              LogError("Failed to apply application rules to kernel");
              return false;
          }
@@ -258,7 +258,7 @@ bool SmackRules::uninstallPackageRules(const std::string &pkgId) {
     try {
         SmackRules rules;
         if (rules.loadFromFile(path)) {
-            if (!rules.clear()) {
+            if (smack_smackfs_path() != NULL && !rules.clear()) {
                 LogWarning("Failed to clear smack kernel rules for pkgId: " << pkgId);
                 // don't stop uninstallation
             }