Drop workaround for all applications labeled with "User" label 71/36471/1
authorRafal Krypa <r.krypa@samsung.com>
Fri, 6 Mar 2015 17:52:20 +0000 (18:52 +0100)
committerRafal Krypa <r.krypa@samsung.com>
Fri, 6 Mar 2015 17:54:07 +0000 (18:54 +0100)
Because every app used to have the same label, special fixes were needed for
app uninstallation not to break Smack policy for "User" label. Now with final
application labels this is no longer needed. Dropping the workaround.

Change-Id: I83d3df1499f8c0eb21d2c954c2fcba3283938a5e
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
src/common/smack-rules.cpp

index 221cf4d..3629e0f 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <unistd.h>
 #include <sys/types.h>
-#include <dirent.h>
 #include <sys/stat.h>
 #include <sys/smack.h>
 #include <fcntl.h>
@@ -253,27 +252,6 @@ void SmackRules::updatePackageRules(const std::string &pkgId, const std::vector<
     smackRules.saveToFile(pkgPath);
 }
 
-/* FIXME: Remove this function if real pkgId instead of "User" label will be used
- * in generateAppLabel(). */
-void SmackRules::addMissingRulesFix()
-{
-    struct dirent *ent;
-
-    std::string path(tzplatform_mkpath(TZ_SYS_SMACK, "accesses.d"));
-    std::unique_ptr<DIR, std::function<int(DIR*)>> dir(opendir(path.c_str()), closedir);
-    if (!dir)
-        ThrowMsg(SmackException::FileError, "opendir");
-
-    while ((ent = readdir(dir.get()))) {
-        SmackRules rules;
-        if (ent->d_type == DT_REG) {
-            rules.loadFromFile(tzplatform_mkpath3(TZ_SYS_SMACK, "accesses.d/", ent->d_name));
-            // Do not check error here. If this fails we can't do anything anyway.
-        }
-        rules.apply();
-    }
-}
-
 void SmackRules::uninstallPackageRules(const std::string &pkgId)
 {
     uninstallRules(getPackageRulesFilePath(pkgId));
@@ -284,9 +262,6 @@ void SmackRules::uninstallApplicationRules(const std::string &appId,
 {
     uninstallRules(getApplicationRulesFilePath(appId));
     updatePackageRules(pkgId, pkgContents);
-
-    // FIXME: Reloading all rules:
-    SmackRules::addMissingRulesFix();
 }
 
 void SmackRules::uninstallRules(const std::string &path)