From 3d4a30a54348aea5378fc410bfba72f10dc96c08 Mon Sep 17 00:00:00 2001 From: Pawel Polawski Date: Mon, 15 Apr 2013 17:01:56 +0200 Subject: [PATCH] Add new tests for new security-server api function [Issue#] SSDWSSP-185 [Feature] New security-server API [Problem] N/A [Cause] N/A [Solution] N/A [Verification] New test should not fail Change-Id: Ie733c0b47545f874b7b7856fc479ccda204cfdbd --- .../security_server_tests_server.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/security-server-tests/security_server_tests_server.cpp b/tests/security-server-tests/security_server_tests_server.cpp index 955c57d..355aca6 100644 --- a/tests/security-server-tests/security_server_tests_server.cpp +++ b/tests/security-server-tests/security_server_tests_server.cpp @@ -405,6 +405,22 @@ RUNNER_TEST(tc01b_security_server_app_give_access) RUNNER_ASSERT(0 == smack_have_access(subject, object, "----t")); } +RUNNER_TEST(tc02_check_privilege_by_pid) +{ + int ret; + int pid; + + pid = getpid(); + + //we checking existing rule, it should return positive + ret = security_server_check_privilege_by_pid(pid, "_", "rx"); + RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS); + + //we checking rule with label that not exist + ret = security_server_check_privilege_by_pid(pid, "thislabelisnotreal", "rwxat"); + RUNNER_ASSERT(ret != SECURITY_SERVER_API_SUCCESS); +} + int main(int argc, char *argv[]) { server_sockfd = -1; -- 2.7.4