Add rule file path getters to PolicyConfiguration 82/231682/2
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 23 Apr 2020 09:48:12 +0000 (11:48 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 28 Apr 2020 11:40:52 +0000 (13:40 +0200)
Change-Id: If06e8ac749aeec23006ae5bd6d78b1658f13031e

src/security-manager-tests/common/policy_configuration.cpp
src/security-manager-tests/common/policy_configuration.h
src/security-manager-tests/common/sm_commons.cpp

index 208155b..156d6bb 100644 (file)
@@ -187,5 +187,12 @@ void PolicyConfiguration::loadPrivGroupMap(void) {
     }
 }
 
+std::string PolicyConfiguration::getPkgRulesFilePath() {
+    return CONF_DIR "pkg-rules-template.smack";
+}
+std::string PolicyConfiguration::getAppRulesFilePath() {
+    return CONF_DIR "app-rules-template.smack";
+}
+
 } // namespace SecurityManagerTest
 
index bce5faf..f807411 100644 (file)
@@ -54,7 +54,9 @@ public:
     GroupVector privToGroup(const PrivVector &privVector);
     GidVector groupToGid(const GroupVector &groupVector);
 
-static bool getIsAskuserEnabled();
+    static bool getIsAskuserEnabled();
+    static std::string getPkgRulesFilePath();
+    static std::string getAppRulesFilePath();
 
 private:
     UserDescription loadUserDescription(UserType userType);
index 7e5f52a..e14f142 100644 (file)
@@ -55,7 +55,6 @@
 
 using namespace SecurityManagerTest;
 
-#define CONF_DIR "/usr/share/security-manager/policy/"
 #define SMACK_RULES_PATH "/sys/fs/smackfs/load2"
 
 #define ALLOW 0
@@ -196,8 +195,8 @@ static void check_app_smack_accesses(const std::string &appId, const std::string
                                      bool isHybrid = false)
 {
     static const std::vector<AccessRequest> rules[] =
-        {parseSmackRulesFile(CONF_DIR "pkg-rules-template.smack"),
-         parseSmackRulesFile(CONF_DIR "app-rules-template.smack")};
+        {parseSmackRulesFile(PolicyConfiguration::getPkgRulesFilePath()),
+         parseSmackRulesFile(PolicyConfiguration::getAppRulesFilePath())};
 
     const std::pair<std::string, std::string> switchAliases[] =
         {std::make_pair("~PATH_RW~", generatePathRWLabel(pkgId)),