CKM: Security-server removed from dependencies
[platform/core/test/security-tests.git] / tests / security-server-tests / cookie_api.cpp
index e6332d6..adb9569 100644 (file)
@@ -53,10 +53,10 @@ RUNNER_TEST_GROUP_INIT(COOKIE_API_TESTS)
  */
 
 //---------------------------------------------------------------------------
-//passing NULL as a buffer pointer
+//passing nullptr as a buffer pointer
 RUNNER_CHILD_TEST(tc_arguments_01_01_security_server_request_cookie)
 {
-    int ret = security_server_request_cookie(NULL, KNOWN_COOKIE_SIZE);
+    int ret = security_server_request_cookie(nullptr, KNOWN_COOKIE_SIZE);
     RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
                       "Error in security_server_request_cookie() argument checking: " << ret);
 }
@@ -72,54 +72,54 @@ RUNNER_CHILD_TEST(tc_arguments_01_02_security_server_request_cookie)
 }
 
 //---------------------------------------------------------------------------
-//passing NULL as a cookie pointer
+//passing nullptr as a cookie pointer
 RUNNER_CHILD_TEST(tc_arguments_02_01_security_server_check_privilege)
 {
-    int ret = security_server_check_privilege(NULL, 0);
+    int ret = security_server_check_privilege(nullptr, 0);
     RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
                       "Error in security_server_check_privilege() argument checking: " << ret);
 }
 
 //---------------------------------------------------------------------------
-//passing NULL as a cookie pointer
+//passing nullptr as a cookie pointer
 RUNNER_CHILD_TEST(tc_arguments_03_01_security_server_check_privilege_by_cookie)
 {
     RUNNER_IGNORED_MSG("security_server_check_privilege_by_cookie is temporarily disabled: always returns success");
-    int ret = security_server_check_privilege_by_cookie(NULL, "wiadro", "rwx");
+    int ret = security_server_check_privilege_by_cookie(nullptr, "wiadro", "rwx");
     RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
                       "Error in security_server_check_privilege_by_cookie() argument checking: "
                       << ret);
 }
 
-//passing NULL as an object pointer
+//passing nullptr as an object pointer
 RUNNER_CHILD_TEST(tc_arguments_03_02_security_server_check_privilege_by_cookie)
 {
     RUNNER_IGNORED_MSG("security_server_check_privilege_by_cookie is temporarily disabled: always returns success");
     Cookie cookie = getCookieFromSS();
 
-    int ret = security_server_check_privilege_by_cookie(cookie.data(), NULL, "rwx");
+    int ret = security_server_check_privilege_by_cookie(cookie.data(), nullptr, "rwx");
     RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
                       "Error in security_server_check_privilege_by_cookie() argument checking: "
                       << ret);
 }
 
-//passing NULL as an access pointer
+//passing nullptr as an access pointer
 RUNNER_CHILD_TEST(tc_arguments_03_03_security_server_check_privilege_by_cookie)
 {
     RUNNER_IGNORED_MSG("security_server_check_privilege_by_cookie is temporarily disabled: always returns success");
     Cookie cookie = getCookieFromSS();
 
-    int ret = security_server_check_privilege_by_cookie(cookie.data(), "wiadro", NULL);
+    int ret = security_server_check_privilege_by_cookie(cookie.data(), "wiadro", nullptr);
     RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
                       "Error in security_server_check_privilege_by_cookie() argument checking: "
                       << ret);
 }
 
 //---------------------------------------------------------------------------
-//passing NULL as a cookie pointer
+//passing nullptr as a cookie pointer
 RUNNER_CHILD_TEST(tc_arguments_04_01_security_server_get_cookie_pid)
 {
-    int ret = security_server_get_cookie_pid(NULL);
+    int ret = security_server_get_cookie_pid(nullptr);
     RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
                       "Error in security_server_get_cookie_pid() argument checking: " << ret);
 }
@@ -133,12 +133,12 @@ RUNNER_TEST(tc_arguments_04_02_security_server_get_cookie_pid)
 }
 
 //---------------------------------------------------------------------------
-//passing NULL as a cookie pointer
+//passing nullptr as a cookie pointer
 RUNNER_CHILD_TEST(tc_arguments_05_01_security_server_get_smacklabel_cookie)
 {
-    char *label = NULL;
-    label = security_server_get_smacklabel_cookie(NULL);
-    RUNNER_ASSERT_MSG(label == NULL,
+    char *label = nullptr;
+    label = security_server_get_smacklabel_cookie(nullptr);
+    RUNNER_ASSERT_MSG(label == nullptr,
                       "Error in security_server_get_smacklabel_cookie() argument checking");
 }
 
@@ -412,8 +412,8 @@ RUNNER_CHILD_TEST_NOSMACK(tc_unit_06_01_security_server_get_smacklabel_cookie_no
     Cookie cookie = getCookieFromSS();
 
     char *receivedLabel = security_server_get_smacklabel_cookie(cookie.data());
-    RUNNER_ASSERT_MSG(receivedLabel != NULL,
-                         "security_server_get_smacklabel_cookie returned NULL");
+    RUNNER_ASSERT_MSG(receivedLabel != nullptr,
+                         "security_server_get_smacklabel_cookie returned nullptr");
     std::string label(receivedLabel);
     free(receivedLabel);
     RUNNER_ASSERT_MSG(label.empty(),
@@ -430,8 +430,8 @@ RUNNER_CHILD_TEST_SMACK(tc_unit_06_02_app_user_security_server_get_smacklabel_co
     provider.applyAndSwithToUser(APP_UID, APP_GID);
 
     CStringPtr label(security_server_get_smacklabel_cookie(cookie.data()));
-    RUNNER_ASSERT_MSG(label.get() == NULL,
-                      "NULL should be received due to access denied, received label: "
+    RUNNER_ASSERT_MSG(label.get() == nullptr,
+                      "nullptr should be received due to access denied, received label: "
                       << label.get());
 }
 
@@ -476,7 +476,7 @@ RUNNER_CHILD_TEST_SMACK(tc_unit_09_01_app_user_cookie_API_access_allow)
     RUNNER_ASSERT_MSG(ret == getpid(), "ret: " << ret);
 
     CStringPtr ss_label(security_server_get_smacklabel_cookie(cookie.data()));
-    RUNNER_ASSERT_MSG(ss_label.get() != NULL, "ss_label: " << ss_label.get());
+    RUNNER_ASSERT_MSG(ss_label.get() != nullptr, "ss_label: " << ss_label.get());
 
     RUNNER_IGNORED_MSG("security_server_check_privilege_by_cookie is temporarily disabled: always returns success");
 
@@ -509,8 +509,8 @@ RUNNER_CHILD_TEST_SMACK(tc_unit_09_02_app_user_cookie_API_access_deny)
             "ret: " << ret);
 
     CStringPtr ss_label(security_server_get_smacklabel_cookie(cookie.data()));
-    RUNNER_ASSERT_MSG(ss_label.get() == NULL,
-            "access should be denied so label should be NULL: " << ss_label.get());
+    RUNNER_ASSERT_MSG(ss_label.get() == nullptr,
+            "access should be denied so label should be nullptr: " << ss_label.get());
 
     RUNNER_IGNORED_MSG("security_server_check_privilege_by_sockfd is temporarily disabled: always returns success");
 
@@ -548,7 +548,7 @@ RUNNER_CHILD_TEST_NOSMACK(tc_unit_09_01_app_user_cookie_API_access_allow_nosmack
             "get_cookie_pid returned different pid than it should. Result: " << ret);
 
     CStringPtr ss_label(security_server_get_smacklabel_cookie(cookie.data()));
-    RUNNER_ASSERT_MSG(ss_label.get() != NULL, "get_smacklabel_cookie failed.");
+    RUNNER_ASSERT_MSG(ss_label.get() != nullptr, "get_smacklabel_cookie failed.");
 
     RUNNER_IGNORED_MSG("security_server_check_privilege_by_sockfd is temporarily disabled: always returns success");