Fix tc_unit_06_01_security_server_get_smacklabel_cookie test. 26/18826/2
authorMarcin Niesluchowski <m.niesluchow@samsung.com>
Tue, 1 Apr 2014 16:44:41 +0000 (18:44 +0200)
committerMarcin Niesluchowski <m.niesluchow@samsung.com>
Tue, 1 Apr 2014 16:59:30 +0000 (18:59 +0200)
Test tc_unit_06_01_security_server_get_smacklabel_cookie fails with
smack disabled.

Verification:
-> security-tests.sh ss-server --output=text --runignored
   (tc_unit_06_01_security_server_get_smacklabel_cookie_* should pass
    with no changes in other tests)

Change-Id: Ia6a56120c777234faed3718a89b01caf91c7281f

tests/security-server-tests/cookie_api.cpp

index 35a135f..bfae680 100644 (file)
@@ -394,7 +394,7 @@ RUNNER_CHILD_TEST_SMACK(tc_unit_05_03_app_user_security_server_get_cookie_pid)
 
 //---------------------------------------------------------------------------
 //root has access to API
-RUNNER_CHILD_TEST(tc_unit_06_01_security_server_get_smacklabel_cookie)
+RUNNER_CHILD_TEST_SMACK(tc_unit_06_01_security_server_get_smacklabel_cookie_smack)
 {
     setLabelForSelf(__LINE__, "selflabel_06_01");
 
@@ -406,6 +406,22 @@ RUNNER_CHILD_TEST(tc_unit_06_01_security_server_get_smacklabel_cookie)
                       << label.get());
 }
 
+//---------------------------------------------------------------------------
+//root has access to API
+RUNNER_CHILD_TEST_NOSMACK(tc_unit_06_01_security_server_get_smacklabel_cookie_nosmack)
+{
+    Cookie cookie = getCookieFromSS();
+
+    char *receivedLabel = security_server_get_smacklabel_cookie(cookie.data());
+    RUNNER_ASSERT_MSG_BT(receivedLabel != NULL,
+                         "security_server_get_smacklabel_cookie returned NULL");
+    std::string label(receivedLabel);
+    free(receivedLabel);
+    RUNNER_ASSERT_MSG_BT(label.empty(),
+                         "security_server_get_smacklabel_cookie returned: "
+                         << label);
+}
+
 //privileges drop and no smack rule
 RUNNER_CHILD_TEST_SMACK(tc_unit_06_02_app_user_security_server_get_smacklabel_cookie)
 {