From: Rafal Krypa Date: Fri, 12 Sep 2014 15:10:27 +0000 (+0200) Subject: security-manager: use Smack label for verifying Cynara rules, not pkgId X-Git-Tag: security-manager_5.5_testing~206 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9cc4733b27deaff7c7aad9499021df6fc92f23a0;p=platform%2Fcore%2Ftest%2Fsecurity-tests.git security-manager: use Smack label for verifying Cynara rules, not pkgId Since security-manager doesn't provide function for that, tests need to reimplement it. It should be kept in line with security-manager code. For now there is only one label for all apps: "User". Change-Id: I79eafea8c38bb86a3ec775a851d7e7605c1865e8 Signed-off-by: Rafal Krypa --- diff --git a/tests/security-manager-tests/security_manager_tests.cpp b/tests/security-manager-tests/security_manager_tests.cpp index eac5194e..476acef5 100644 --- a/tests/security-manager-tests/security_manager_tests.cpp +++ b/tests/security-manager-tests/security_manager_tests.cpp @@ -52,6 +52,11 @@ static const char *const SM_DENIED_PATH = "/etc/smack/test_DIR/non_app_dir"; static const char *const SM_PRIVATE_PATH_FOR_USER_5000 = "/home/app/securitytests/test_DIR"; static const char *const ANY_USER_REPRESENTATION = "anyuser";/*this may be actually any string*/ +static void generateAppLabel(const std::string &pkgId, std::string &label) +{ + (void) pkgId; + label = "User"; +} static bool isLinkToExec(const char *fpath, const struct stat *sb) @@ -215,15 +220,17 @@ static void check_app_permissions(const char *const app_id, const char *const pk const privileges_t &allowed_privs, const privileges_t &denied_privs) { (void) app_id; + std::string smackLabel; + generateAppLabel(pkg_id, smackLabel); CynaraTestClient ctc; for (auto &priv : allowed_privs) { - ctc.check(pkg_id, "", user, priv.c_str(), CYNARA_API_SUCCESS); + ctc.check(smackLabel.c_str(), "", user, priv.c_str(), CYNARA_API_SUCCESS); } for (auto &priv : denied_privs) { - ctc.check(pkg_id, "", user, priv.c_str(), CYNARA_API_ACCESS_DENIED); + ctc.check(smackLabel.c_str(), "", user, priv.c_str(), CYNARA_API_ACCESS_DENIED); } }