From d032b3c6077c900c0daf7961c62431e92e43563a Mon Sep 17 00:00:00 2001 From: Bartlomiej Grzelewski Date: Mon, 22 Apr 2013 18:23:37 +0200 Subject: [PATCH] Test to: Implemet data control solution for OSP apps. [Issue#] SSDWSSP-177 [Bug] N/A [Cause] OPS application need to share memory. [Solution] Add cross rules between OSP application. Change-Id: I29b24d3fa8410b0f444f494d45e1c283605ce2af --- .../security_server_tests_server.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/security-server-tests/security_server_tests_server.cpp b/tests/security-server-tests/security_server_tests_server.cpp index 355aca6..b2e5e66 100644 --- a/tests/security-server-tests/security_server_tests_server.cpp +++ b/tests/security-server-tests/security_server_tests_server.cpp @@ -372,6 +372,7 @@ RUNNER_CHILD_TEST(tc01a_security_server_app_give_access) { const char *subject = "abc345v34sfa"; const char *object = "efg678x2lkjz"; + const char *server_api = "security-server::api-data-share"; smack_accesses *tmp = NULL; RUNNER_ASSERT(0 == smack_accesses_new(&tmp)); @@ -380,6 +381,7 @@ RUNNER_CHILD_TEST(tc01a_security_server_app_give_access) smack(tmp, smack_accesses_free); RUNNER_ASSERT(0 == smack_accesses_add(smack.get(), subject, object, "-----")); + RUNNER_ASSERT(0 == smack_accesses_add(smack.get(), object, server_api, "rw")); RUNNER_ASSERT(0 == smack_accesses_apply(smack.get())); smack_set_label_for_self(object); @@ -405,6 +407,26 @@ RUNNER_TEST(tc01b_security_server_app_give_access) RUNNER_ASSERT(0 == smack_have_access(subject, object, "----t")); } +RUNNER_CHILD_TEST(tc01c_security_server_app_give_access_no_access) +{ + const char *subject = "xxx45v34sfa"; + const char *object = "yyy78x2lkjz"; + smack_accesses *tmp = NULL; + + RUNNER_ASSERT(0 == smack_accesses_new(&tmp)); + + std::unique_ptr> + smack(tmp, smack_accesses_free); + + RUNNER_ASSERT(0 == smack_accesses_add(smack.get(), subject, object, "-----")); + RUNNER_ASSERT(0 == smack_accesses_apply(smack.get())); + + smack_set_label_for_self(object); + RUNNER_ASSERT(SECURITY_SERVER_API_ERROR_ACCESS_DENIED == security_server_app_give_access(subject, getpid())); + + RUNNER_ASSERT(0 == smack_have_access(subject, object, "r")); +} + RUNNER_TEST(tc02_check_privilege_by_pid) { int ret; -- 2.7.4