Install vconf key for testing key-manager in packaging install time.
authorkyungwook tak <k.tak@samsung.com>
Wed, 11 Feb 2015 06:08:03 +0000 (15:08 +0900)
committerMaciej J. Karpiuk <m.karpiuk2@samsung.com>
Wed, 18 Feb 2015 09:50:08 +0000 (10:50 +0100)
vconf key cannot Install(set at first time)/unset in runtime.
It should be installed in package(rpm) install time.

Change-Id: I196df5cb8a7e6b6a9a0653d66dfc6e9e55e73e52
Signed-off-by: kyungwook tak <k.tak@samsung.com>
packaging/security-tests.spec
tests/ckm/cc-mode.cpp

index 00f4cc64a9d920a2ef1d04fb3dd187bfd790f5e5..05a29b6d3572650b742a1a82de564b540391c06c 100644 (file)
@@ -64,7 +64,13 @@ find /etc/smack/test_privilege_control_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
+api_feature_loader --verbose --clear-permissions
+
+# Set vconf key for cc-mode testing if vconf key isn't there.
+%if "%{sec_product_feature_security_mdfpp_enable}" != "1"
+    echo "Install vconf key (file/security_mdpp/security_mdpp_state) for testing key-manager"
+    vconftool set -t string file/security_mdpp/security_mdpp_state "Unset"
+%endif
 
 echo "security-tests postinst done ..."
 
index d740e757ce37034db0b3531a9fa040945621c357..c54f3a6b654997438d77d77aef9c6ebbaa4e2b2e 100644 (file)
@@ -52,12 +52,18 @@ const char* const ENABLED = "Enabled";
 const char* const ENFORCING = "Enforcing";
 const char* const DISABLED = "Disabled";
 const char* const READY = "Ready";
+const char* const UNSET = "Unset"; // Meaningless value for unset.
 
 const char* const CKM_LOCK = "/var/run/key-manager.pid";
 
 
 // disable CC
-int _unset_mdpp_key = vconf_unset(VCONFKEY_SECURITY_MDPP_STATE);
+/*
+ * k.tak: To unset vconf key on runtime is deprecated by vconf key policy.
+ *        To make new vconf key on runtime is deprecated by vconf key policy.
+ *        vconf key should be installed in package install time.
+ */
+int _unset_mdpp_key = vconf_set_str(VCONFKEY_SECURITY_MDPP_STATE, UNSET);
 
 // Wrapper for mdpp state that restores the original value upon destruction
 class MdppState
@@ -81,7 +87,7 @@ MdppState::MdppState()
 MdppState::~MdppState()
 {
     if (!m_original)
-        vconf_unset(VCONFKEY_SECURITY_MDPP_STATE);
+        vconf_set_str(VCONFKEY_SECURITY_MDPP_STATE, UNSET);
     else {
         vconf_set_str(VCONFKEY_SECURITY_MDPP_STATE, m_original);
         free(m_original);
@@ -94,7 +100,7 @@ void MdppState::set(const char* const value)
         RUNNER_ASSERT_MSG(0 == vconf_set_str(VCONFKEY_SECURITY_MDPP_STATE, value),
                              "vconf_set() failed");
     else
-        vconf_unset(VCONFKEY_SECURITY_MDPP_STATE);
+        vconf_set_str(VCONFKEY_SECURITY_MDPP_STATE, UNSET);
 }
 
 void remove_user_data()