security-manager tests: reorganize directories used and registered by apps 57/30457/2
authorMarcin Lis <m.lis@samsung.com>
Tue, 18 Nov 2014 15:04:56 +0000 (16:04 +0100)
committerMarcin Lis <m.lis@samsung.com>
Wed, 19 Nov 2014 09:15:49 +0000 (10:15 +0100)
1. Move global user directories from /etc/smack/ to its home dir: /usr/apps/
2. Remove directories, functions and checks associated with
   SECURITY_MANAGER_PATH_PUBLIC - it should not be used anymore and will be
   removed.

[Verification] run security-manager-tests and ensure that all succeed.

Change-Id: Ifb04fd19b35cc226473159728d172525fbc44bdc
Signed-off-by: Marcin Lis <m.lis@samsung.com>
26 files changed:
packaging/security-tests.spec
tests/security-manager-tests/CMakeLists.txt
tests/security-manager-tests/security_manager_tests.cpp
tests/security-manager-tests/test_DIR/app_dir_public/.level_1/.level_2/exec [deleted file]
tests/security-manager-tests/test_DIR/app_dir_public/.level_1/.level_2/normal [deleted file]
tests/security-manager-tests/test_DIR/app_dir_public/.level_1/exec [deleted file]
tests/security-manager-tests/test_DIR/app_dir_public/.level_1/level_2/exec [deleted file]
tests/security-manager-tests/test_DIR/app_dir_public/.level_1/level_2/normal [deleted file]
tests/security-manager-tests/test_DIR/app_dir_public/.level_1/normal [deleted file]
tests/security-manager-tests/test_DIR/app_dir_public/exec [deleted file]
tests/security-manager-tests/test_DIR/app_dir_public/level_1/.level_2/exec [deleted file]
tests/security-manager-tests/test_DIR/app_dir_public/level_1/.level_2/normal [deleted file]
tests/security-manager-tests/test_DIR/app_dir_public/level_1/exec [deleted file]
tests/security-manager-tests/test_DIR/app_dir_public/level_1/level_2/exec [deleted file]
tests/security-manager-tests/test_DIR/app_dir_public/level_1/level_2/link_to_exec [deleted symlink]
tests/security-manager-tests/test_DIR/app_dir_public/level_1/level_2/link_to_non_exec [deleted symlink]
tests/security-manager-tests/test_DIR/app_dir_public/level_1/level_2/normal [deleted file]
tests/security-manager-tests/test_DIR/app_dir_public/level_1/link_to_exec [deleted symlink]
tests/security-manager-tests/test_DIR/app_dir_public/level_1/link_to_non_exec [deleted symlink]
tests/security-manager-tests/test_DIR/app_dir_public/level_1/normal [deleted file]
tests/security-manager-tests/test_DIR/app_dir_public/link_to_exec [deleted symlink]
tests/security-manager-tests/test_DIR/app_dir_public/link_to_non_app_dir [deleted symlink]
tests/security-manager-tests/test_DIR/app_dir_public/link_to_non_app_exec [deleted symlink]
tests/security-manager-tests/test_DIR/app_dir_public/link_to_non_app_normal [deleted symlink]
tests/security-manager-tests/test_DIR/app_dir_public/link_to_non_exec [deleted symlink]
tests/security-manager-tests/test_DIR/app_dir_public/normal [deleted file]

index 255d65dd04863a39bdffd5b937db7cf4e2a92ac4..fb160748cb9719dbf7d4ca726bc493727bbd3bde 100644 (file)
@@ -60,7 +60,7 @@ ln -sf /etc/smack/test_smack_rules %{buildroot}/etc/smack/test_smack_rules_lnk
 %{_bindir}/gum-utils --add-user --username=security-tests-app --usertype=4 --offline
 
 find /etc/smack/test_privilege_control_DIR/ -type f -name exec -exec chmod 0755 {} +
-find /etc/smack/test_DIR/ -type f -name exec -exec chmod 0755 {} +
+find /usr/apps/test_DIR/ -type f -name exec -exec chmod 0755 {} +
 
 # Load permissions templates
 api_feature_loader --verbose
@@ -100,7 +100,7 @@ echo "security-tests postinst done ..."
 /etc/smack/test_smack_rules_lnk
 /usr/share/privilege-control/*
 /etc/smack/test_privilege_control_DIR/*
-/etc/smack/test_DIR/*
+/usr/apps/test_DIR/*
 /home/security-tests-app/test_DIR
 /usr/bin/test-app-efl
 /usr/bin/test-app-osp
index 1f190bb6b8f0db485ed1e57e7bee23f03a2286f1..9392c3ee26eee2f3c6043a6d8cb01069390da51c 100644 (file)
@@ -68,7 +68,7 @@ INSTALL(TARGETS ${TARGET_SEC_MGR_TESTS} DESTINATION /usr/bin)
 
 INSTALL(DIRECTORY
     ${PROJECT_SOURCE_DIR}/tests/security-manager-tests/test_DIR
-    DESTINATION /etc/smack/
+    DESTINATION /usr/apps/
 )
 
 INSTALL(DIRECTORY
index afe4c1836f9d1cbe0a021f667f1840bf3d4b539e..ab6c0cd221c3b85625b541cf5ed58d59bb8c5fdd 100644 (file)
@@ -49,10 +49,9 @@ static const privileges_t SM_NO_PRIVILEGES  = {
 
 static const std::vector<std::string> SM_ALLOWED_GROUPS = {"db_browser", "db_alarm"};
 
-static const char *const SM_PRIVATE_PATH = "/etc/smack/test_DIR/app_dir";
-static const char *const SM_PUBLIC_PATH = "/etc/smack/test_DIR/app_dir_public";
-static const char *const SM_PUBLIC_RO_PATH = "/etc/smack/test_DIR/app_dir_public_ro";
-static const char *const SM_DENIED_PATH = "/etc/smack/test_DIR/non_app_dir";
+static const char *const SM_PRIVATE_PATH = "/usr/apps/test_DIR/app_dir";
+static const char *const SM_PUBLIC_RO_PATH = "/usr/apps/test_DIR/app_dir_public_ro";
+static const char *const SM_DENIED_PATH = "/usr/apps/test_DIR/non_app_dir";
 static const char *const SM_PRIVATE_PATH_FOR_USER = "/home/" APP_USER "/test_DIR";
 static const char *const ANY_USER_REPRESENTATION = "anyuser";/*this may be actually any string*/
 
@@ -115,13 +114,6 @@ static int nftw_check_sm_labels_app_private_dir(const char *fpath, const struct
     return nftw_check_sm_labels_app_dir(fpath, sb, USER_APP_ID, false, true);
 }
 
-static int nftw_check_sm_labels_app_public_dir(const char *fpath, const struct stat *sb,
-                               int /*typeflag*/, struct FTW* /*ftwbuf*/)
-{
-
-    return nftw_check_sm_labels_app_dir(fpath, sb, "User", true, false);
-}
-
 static int nftw_check_sm_labels_app_floor_dir(const char *fpath, const struct stat *sb,
                                int /*typeflag*/, struct FTW* /*ftwbuf*/)
 {
@@ -148,9 +140,6 @@ static void prepare_app_path()
     result = nftw(SM_PRIVATE_PATH, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
     RUNNER_ASSERT_MSG(result == 0, "Unable to clean Smack labels in " << SM_PRIVATE_PATH);
 
-    result = nftw(SM_PUBLIC_PATH, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
-    RUNNER_ASSERT_MSG(result == 0, "Unable to clean Smack labels in " << SM_PUBLIC_PATH);
-
     result = nftw(SM_PUBLIC_RO_PATH, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
     RUNNER_ASSERT_MSG(result == 0, "Unable to clean Smack labels in " << SM_PUBLIC_RO_PATH);
 
@@ -171,9 +160,6 @@ static void check_app_path_after_install()
     result = nftw(SM_PRIVATE_PATH, &nftw_check_sm_labels_app_private_dir, FTW_MAX_FDS, FTW_PHYS);
     RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for " << SM_PRIVATE_PATH);
 
-    result = nftw(SM_PUBLIC_PATH, &nftw_check_sm_labels_app_public_dir, FTW_MAX_FDS, FTW_PHYS);
-    RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for " << SM_PUBLIC_PATH);
-
     result = nftw(SM_PUBLIC_RO_PATH, &nftw_check_sm_labels_app_floor_dir, FTW_MAX_FDS, FTW_PHYS);
     RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for " << SM_PUBLIC_RO_PATH);
 
@@ -402,11 +388,6 @@ RUNNER_TEST(security_manager_02_app_install_uninstall_full)
     RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
             "setting allowed path failed. Result: " << result);
 
-    result = security_manager_app_inst_req_add_path(request.get(), SM_PUBLIC_PATH,
-                                                    SECURITY_MANAGER_PATH_PUBLIC);
-    RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
-            "setting allowed path failed. Result: " << result);
-
     result = security_manager_app_inst_req_add_path(request.get(), SM_PUBLIC_RO_PATH,
                                                     SECURITY_MANAGER_PATH_PUBLIC_RO);
     RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/.level_1/.level_2/exec b/tests/security-manager-tests/test_DIR/app_dir_public/.level_1/.level_2/exec
deleted file mode 100755 (executable)
index e69de29..0000000
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/.level_1/.level_2/normal b/tests/security-manager-tests/test_DIR/app_dir_public/.level_1/.level_2/normal
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/.level_1/exec b/tests/security-manager-tests/test_DIR/app_dir_public/.level_1/exec
deleted file mode 100755 (executable)
index e69de29..0000000
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/.level_1/level_2/exec b/tests/security-manager-tests/test_DIR/app_dir_public/.level_1/level_2/exec
deleted file mode 100755 (executable)
index e69de29..0000000
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/.level_1/level_2/normal b/tests/security-manager-tests/test_DIR/app_dir_public/.level_1/level_2/normal
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/.level_1/normal b/tests/security-manager-tests/test_DIR/app_dir_public/.level_1/normal
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/exec b/tests/security-manager-tests/test_DIR/app_dir_public/exec
deleted file mode 100755 (executable)
index e69de29..0000000
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/level_1/.level_2/exec b/tests/security-manager-tests/test_DIR/app_dir_public/level_1/.level_2/exec
deleted file mode 100755 (executable)
index e69de29..0000000
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/level_1/.level_2/normal b/tests/security-manager-tests/test_DIR/app_dir_public/level_1/.level_2/normal
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/level_1/exec b/tests/security-manager-tests/test_DIR/app_dir_public/level_1/exec
deleted file mode 100755 (executable)
index e69de29..0000000
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/level_1/level_2/exec b/tests/security-manager-tests/test_DIR/app_dir_public/level_1/level_2/exec
deleted file mode 100755 (executable)
index e69de29..0000000
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/level_1/level_2/link_to_exec b/tests/security-manager-tests/test_DIR/app_dir_public/level_1/level_2/link_to_exec
deleted file mode 120000 (symlink)
index f1b66f3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-exec
\ No newline at end of file
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/level_1/level_2/link_to_non_exec b/tests/security-manager-tests/test_DIR/app_dir_public/level_1/level_2/link_to_non_exec
deleted file mode 120000 (symlink)
index 5ae0346..0000000
+++ /dev/null
@@ -1 +0,0 @@
-normal
\ No newline at end of file
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/level_1/level_2/normal b/tests/security-manager-tests/test_DIR/app_dir_public/level_1/level_2/normal
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/level_1/link_to_exec b/tests/security-manager-tests/test_DIR/app_dir_public/level_1/link_to_exec
deleted file mode 120000 (symlink)
index f1b66f3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-exec
\ No newline at end of file
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/level_1/link_to_non_exec b/tests/security-manager-tests/test_DIR/app_dir_public/level_1/link_to_non_exec
deleted file mode 120000 (symlink)
index 5ae0346..0000000
+++ /dev/null
@@ -1 +0,0 @@
-normal
\ No newline at end of file
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/level_1/normal b/tests/security-manager-tests/test_DIR/app_dir_public/level_1/normal
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/link_to_exec b/tests/security-manager-tests/test_DIR/app_dir_public/link_to_exec
deleted file mode 120000 (symlink)
index f1b66f3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-exec
\ No newline at end of file
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/link_to_non_app_dir b/tests/security-manager-tests/test_DIR/app_dir_public/link_to_non_app_dir
deleted file mode 120000 (symlink)
index 4c67b09..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../non_app_dir
\ No newline at end of file
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/link_to_non_app_exec b/tests/security-manager-tests/test_DIR/app_dir_public/link_to_non_app_exec
deleted file mode 120000 (symlink)
index 94e5405..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../non_app_dir/exec
\ No newline at end of file
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/link_to_non_app_normal b/tests/security-manager-tests/test_DIR/app_dir_public/link_to_non_app_normal
deleted file mode 120000 (symlink)
index f7f5e53..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../non_app_dir/normal
\ No newline at end of file
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/link_to_non_exec b/tests/security-manager-tests/test_DIR/app_dir_public/link_to_non_exec
deleted file mode 120000 (symlink)
index 5ae0346..0000000
+++ /dev/null
@@ -1 +0,0 @@
-normal
\ No newline at end of file
diff --git a/tests/security-manager-tests/test_DIR/app_dir_public/normal b/tests/security-manager-tests/test_DIR/app_dir_public/normal
deleted file mode 100644 (file)
index e69de29..0000000