Set smack label for preloaded app.
authorSoyoung Kim <sy037.kim@samsung.com>
Fri, 12 Jul 2013 04:53:47 +0000 (13:53 +0900)
committerSoyoung Kim <sy037.kim@samsung.com>
Sat, 13 Jul 2013 09:48:57 +0000 (18:48 +0900)
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] Set smack label for preloaded app.
[SCMRequest] N/A

Change-Id: I1614ea7ec61cf15ab55dfdb592708f168377408b

src/jobs/widget_install/task_smack.cpp

index 86dfbfd..9b99814 100644 (file)
@@ -98,6 +98,16 @@ void TaskSmack::StepSmackFolderLabeling()
                 m_context.locations->getPackageInstallationDir());
     }
 
+    /* for prealod */
+    if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD &&
+            m_context.mode.extension != InstallMode::ExtensionType::DIR)
+    {
+        if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+                    m_context.locations->getUserDataRootDir().c_str(),
+                    APP_PATH_ANY_LABEL, "_")) {
+        }
+    }
+
     /* res directory */
     std::string resDir = m_context.locations->getPackageInstallationDir() +
         "/res";
@@ -114,16 +124,6 @@ void TaskSmack::StepSmackFolderLabeling()
         LogWarning("Add label to " << m_context.locations->getPrivateStorageDir());
     }
 
-    /* for prealod */
-    if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD &&
-            m_context.mode.extension != InstallMode::ExtensionType::DIR)
-    {
-        if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
-                    m_context.locations->getUserDataRootDir().c_str(),
-                    APP_PATH_GROUP_RW, "_")) {
-        }
-    }
-
     /* tmp directory */
     if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
                 m_context.locations->getPrivateTempStorageDir().c_str(),
@@ -211,12 +211,6 @@ void TaskSmack::StepAbortSmack()
     LogInfo("----------------> SMACK:\
             Jobs::WidgetInstall::TaskSmack::StepAbortSmack()");
 #ifdef WRT_SMACK_ENABLED
-    /* TODO :
-    std::string id = DPL::ToUTF8String(m_context.widgetConfig.tzAppid);
-    char* appId = NULL;
-    appId = (char*)calloc(1, id.length() + 1);
-    snprintf(appId, id.length() + 1, "%s", id.c_str());
-    */
 
     if (PC_OPERATION_SUCCESS != app_revoke_permissions(m_pkgId)) {
         LogWarning("failure in revoking smack permissions");
@@ -238,14 +232,21 @@ void TaskSmack::StepSetEndofInstallation()
 
 bool TaskSmack::setLabelForSharedDir(const char* pkgId)
 {
-    /* shared/res directory */
+    /* /shared directory */
+    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+                m_context.locations->getSharedRootDir().c_str(),
+                APP_PATH_ANY_LABEL, "_")) {
+        LogWarning("Add label to " << m_context.locations->getUserDataRootDir());
+    }
+
+    /* /shared/res directory */
     if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
                 m_context.locations->getSharedResourceDir().c_str(),
                 APP_PATH_ANY_LABEL, "_")) {
         LogWarning("Add label to " << m_context.locations->getSharedResourceDir());
     }
 
-    /* shared/trusted directory */
+    /* /shared/trusted directory */
     CertificatePtr rootCert = m_context.wacSecurity.getAuthorCertificatePtr();
     if (rootCert.Get() != NULL) {
         ValidationCore::Crypto::Hash::SHA1 sha1;
@@ -267,7 +268,7 @@ bool TaskSmack::setLabelForSharedDir(const char* pkgId)
         }
     }
 
-    /* shared/data directory */
+    /* /shared/data directory */
     if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
                 m_context.locations->getSharedDataDir().c_str(),
                 APP_PATH_PUBLIC_RO)) {