Apply smack new api
authorDuyoung Jang <duyoung.jang@samsung.com>
Wed, 3 Jul 2013 04:39:37 +0000 (13:39 +0900)
committerDuyoung Jang <duyoung.jang@samsung.com>
Wed, 3 Jul 2013 04:39:37 +0000 (13:39 +0900)
Change-Id: Iccef6409932a115dcbf9a4298ce8e292fbd8d085
Signed-off-by: Duyoung Jang <duyoung.jang@samsung.com>
inc/InstallerDefs.h
src/Context/InstallationContext.cpp
src/Context/InstallationContext.h
src/Manager/CompatibilityManager.cpp
src/Manager/PermissionManager.cpp
src/Manager/PermissionManager.h
src/Manager/SmackManager.cpp
src/Manager/SmackManager.h
src/Util/InstallerUtil.cpp
src/XmlHandler/ManifestHandler.cpp

index 8762804..ccb23b5 100755 (executable)
@@ -23,7 +23,7 @@
 
 #include "InstallerUtil.h"
 
-#define OSP_INSTALLER_VERSION "version=[20130702.1]"
+#define OSP_INSTALLER_VERSION "version=[20130703.1]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
@@ -364,4 +364,14 @@ enum PrivilegeLevel
 
 };
 
+enum SmackDirType
+{
+       SMACK_DIR_TYPE_PRIVATE,
+       SMACK_DIR_TYPE_GROUP_RW,
+       SMACK_DIR_TYPE_PUBLIC_RO,
+       SMACK_DIR_TYPE_SETTINGS_RW,
+       SMACK_DIR_TYPE_ANY_LABEL,
+
+};
+
 #endif // _INSTALLER_DEFS_H_
index 621543a..27b6bf8 100755 (executable)
@@ -52,7 +52,6 @@ InstallationContext::InstallationContext(void)
 ,__isVerificationMode(false)
 ,__isUpdated(false)
 ,__isAppSetting(false)
-,__isAntiVirus(false)
 ,__isCsc(false)
 ,__isUninstallable(false)
 ,__isVirtualRoot(false)
index 16ab280..69bbc7f 100755 (executable)
@@ -100,7 +100,6 @@ public:
        bool __isVerificationMode;
        bool __isUpdated;
        bool __isAppSetting;
-       bool __isAntiVirus;
        bool __isCsc;
        bool __isUninstallable;
        bool __isVirtualRoot;
index cbb28b0..fc63da4 100755 (executable)
@@ -292,7 +292,7 @@ CompatibilityManager::PrepareVirtualRoot(const Tizen::Base::String& rootPath, co
        res = CreateVirtualRootDirectories();
        TryCatch(res == true, , "CreateVirtualRootDirectories() failed.");
 
-       smackManager.AddLabelDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_PRIVATE);
 
        res = CreateSymbolicLink();
        TryCatch(res == true, , "CreateSymbolicLink() failed.");
@@ -438,7 +438,7 @@ CompatibilityManager::CreateOspInternalDirectories(const String& rootPath, const
        }
 
        SmackManager smackManager;
-       smackManager.AddLabelDir(L"_", L"./Storagecard");
+       smackManager.SetupPath(packageId, L"./Storagecard", SMACK_DIR_TYPE_ANY_LABEL, L"_");
 
        ospShareAppIdPath.Append(packageId);
 
@@ -490,12 +490,16 @@ CompatibilityManager::CreateOspInternalDirectories(const String& rootPath, const
        r = Directory::Remove(appSharedTrustedPath, true);
        TryReturn(r == E_SUCCESS, false, "Directory::Remove(%ls) failed.", appSharedTrustedPath.GetPointer());
 
-       res = InstallerUtil::CreateSymlink(ospShareAppIdPath, L"./shared/data");
+       res = InstallerUtil::CreateSymlink(ospShareAppIdPath, L"./shared/data", false);
        TryReturn(res == true, false, "CreateSymlink() failed, errno: %d (%s), link: ./shared/data -> %s", errno, strerror(errno), pOspShareAppIdPath.get());
 
-       res = InstallerUtil::CreateSymlink(ospShare2AppIdPath, L"./shared/trusted");
+       smackManager.SetupPath(packageId, ospShareAppIdPath, SMACK_DIR_TYPE_PUBLIC_RO);
+
+       res = InstallerUtil::CreateSymlink(ospShare2AppIdPath, L"./shared/trusted", false);
        TryReturn(res == true, false, " CreateSymlink() failed, errno: %d (%s), link: ./shared/trusted -> %s", errno, strerror(errno), pOspShare2AppIdPath.get());
 
+       smackManager.SetupPath(packageId, ospShare2AppIdPath, SMACK_DIR_TYPE_GROUP_RW);
+
        AppLog("[Tizen::Io] CreateOspInternalDirectories() succeeded, rootPath: %ls", rootPath.GetPointer());
        return true;
 }
index f956744..5967f8d 100755 (executable)
@@ -66,7 +66,7 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
        // appRoot
        // InstallerUtil::ChangeOwner(appRootPath);
        InstallerUtil::ChangeMode(appRootPath, PERM_BASE | PERM_EXECUTE);
-       smackManager.AddLabelDir(packageId, appRootPath, true);
+       smackManager.SetupPath(packageId, appRootPath, SMACK_DIR_TYPE_ANY_LABEL, L"_");
 
        if (pContext->__isPreloaded == true)
        {
@@ -74,28 +74,28 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
                preloadedAppPath += L"/";
                preloadedAppPath += packageId;
 
-               smackManager.AddLabelDir(L"_", preloadedAppPath, true);
+               smackManager.SetupPath(packageId, preloadedAppPath, SMACK_DIR_TYPE_ANY_LABEL, L"_");
        }
 
        // appRoot/bin
        destPath = appRootPath + DIR_BIN;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_EXECUTE, false);
-       smackManager.AddLabelDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_PRIVATE);
 
        // appRoot/info
        destPath = appRootPath + DIR_INFO;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
-       smackManager.AddLabelDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_PRIVATE);
 
        // appRoot/res
        destPath = appRootPath + DIR_RES;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
-       smackManager.AddLabelDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_PRIVATE);
 
        // appRoot/lib
        destPath = appRootPath + DIR_LIB;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_EXECUTE, false);
-       smackManager.AddLabelDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_PRIVATE);
 
        // appRoot/shared
        destPath = appRootPath + DIR_SHARED;
@@ -105,7 +105,6 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
                TryReturn(!IsFailed(r), INSTALLER_ERROR_INTERNAL_STATE, "Directory::Create() failed");
        }
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
-       smackManager.AddLabelDir(packageId, destPath);
 
        // appRoot/shared/res
        destPath = appRootPath + DIR_SHARED_RES;
@@ -115,22 +114,21 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
                InstallerUtil::CreateSymlink(iconPath, destPath);
        }
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
-       smackManager.AddLabelDir(packageId, destPath);
 
        // appRoot/shared/data
        destPath = appRootPath + DIR_SHARED_DATA;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, true);
-       smackManager.AddLabelSharedDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_PUBLIC_RO);
 
        // appRoot/shared/trusted
        destPath = appRootPath + DIR_SHARED_TRUSTED;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, true);
-       smackManager.AddLabelSharedDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_GROUP_RW);
 
        // appRoot/contents
        destPath = appRootPath + DIR_CONTENTS;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
-       smackManager.AddLabelDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_PRIVATE);
 
        // appRoot/setting
        destPath = appRootPath + DIR_SETTING;
@@ -139,10 +137,6 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
                String appVersion = pContext->__version;
                String srcPath;
                String settingXmlPath;
-               String label = "*";
-               //String label = packageId;
-               //label.Append("_setting");
-
                srcPath = destPath + L"/setting." + appVersion + L".xml";
                settingXmlPath = destPath + L"/setting.xml";
 
@@ -150,7 +144,7 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
                InstallerUtil::CreateSymlink(srcPath, settingXmlPath);
 
                InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_WRITE, false);
-               smackManager.AddLabelDir(label, destPath);
+               smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_SETTINGS_RW);
        }
 
        // appRoot/data
@@ -161,7 +155,7 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
                TryReturn(!IsFailed(r), false, "Directory::Create() failed");
        }
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, true);
-       smackManager.AddLabelDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_PRIVATE);
 
        String apiVersion = pContext->__apiVersion;
 
@@ -234,6 +228,7 @@ PermissionManager::SetSymLink(InstallationContext* pContext)
        String appRootPath = pContext->__rootPath;
 
        SmackManager smackManager;
+       smackManager.Construct(pContext);
 
 #if 0
        oldPath = appRootPath + DIR_RES;
@@ -243,7 +238,7 @@ PermissionManager::SetSymLink(InstallationContext* pContext)
        newPath = appRootPath + L"/Res";
        std::unique_ptr< char[] > pResPath(_StringConverter::CopyToCharArrayN(newPath));
        int ret = symlink("./res", pResPath.get());
-       smackManager.AddLabelDir(pContext->__packageId, newPath);
+       smackManager.SetupPath(pContext->__packageId, newPath, SMACK_DIR_TYPE_ANY_LABEL, L"_");
 #endif
 
 #if 0
@@ -254,24 +249,24 @@ PermissionManager::SetSymLink(InstallationContext* pContext)
        newPath = appRootPath + L"/Home";
        std::unique_ptr< char[] > pHomePath(_StringConverter::CopyToCharArrayN(newPath));
        ret = symlink("./data", pHomePath.get());
-       smackManager.AddLabelDir(pContext->__packageId, newPath);
+       smackManager.SetupPath(pContext->__packageId, newPath, SMACK_DIR_TYPE_ANY_LABEL, L"_");
 #endif
 
        oldPath = appRootPath + DIR_RES + L"/screen-size-normal";
        newPath = appRootPath + L"/Res/ScreenSize-Normal";
-       InstallerUtil::CreateSymlink(oldPath, newPath);
+       InstallerUtil::CreateSymlink(oldPath, newPath, false);
 
        oldPath = appRootPath + DIR_RES + L"/screen-density-high";
        newPath = appRootPath + L"/Res/ScreenDensity-High";
-       InstallerUtil::CreateSymlink(oldPath, newPath);
+       InstallerUtil::CreateSymlink(oldPath, newPath, false);
 
        oldPath = appRootPath + DIR_RES + L"/screen-density-middle";
        newPath = appRootPath + L"/Res/ScreenDensity-Middle";
-       InstallerUtil::CreateSymlink(oldPath, newPath);
+       InstallerUtil::CreateSymlink(oldPath, newPath, false);
 
        oldPath = appRootPath + DIR_RES + L"/screen-density-low";
        newPath = appRootPath + L"/Res/ScreenDensity-Low";
-       InstallerUtil::CreateSymlink(oldPath, newPath);
+       InstallerUtil::CreateSymlink(oldPath, newPath, false);
 
        return true;
 }
@@ -356,57 +351,55 @@ PermissionManager::ApplyPermissionForRds(InstallationContext* pContext)
 
        // appRoot
        InstallerUtil::ChangeMode(appRootPath, PERM_BASE | PERM_EXECUTE);
-       smackManager.AddLabelDir(packageId, appRootPath, true);
+       smackManager.SetupPath(packageId, appRootPath, SMACK_DIR_TYPE_ANY_LABEL, L"_");
 
        // appRoot/bin
        destPath = appRootPath + DIR_BIN;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_EXECUTE, false);
-       smackManager.AddLabelDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_PRIVATE);
 
        // appRoot/info
        destPath = appRootPath + DIR_INFO;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
-       smackManager.AddLabelDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_PRIVATE);
 
        // appRoot/res
        destPath = appRootPath + DIR_RES;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
-       smackManager.AddLabelDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_PRIVATE);
 
        // appRoot/lib
        destPath = appRootPath + DIR_LIB;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_EXECUTE, false);
-       smackManager.AddLabelDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_PRIVATE);
 
        // appRoot/shared
        destPath = appRootPath + DIR_SHARED;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
-       smackManager.AddLabelDir(packageId, destPath);
 
        // appRoot/shared/res
        destPath = appRootPath + DIR_SHARED_RES;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
-       smackManager.AddLabelSharedDir(packageId, destPath);
 
        // appRoot/shared/data
        destPath = appRootPath + DIR_SHARED_DATA;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, true);
-       smackManager.AddLabelSharedDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_PUBLIC_RO);
 
        // appRoot/shared/trusted
        destPath = appRootPath + DIR_SHARED_TRUSTED;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, true);
-       smackManager.AddLabelSharedDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_GROUP_RW);
 
        // appRoot/setting
        destPath = appRootPath + DIR_SETTING;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_WRITE, false);
-       smackManager.AddLabelDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_SETTINGS_RW);
 
        // appRoot/data
        destPath = appRootPath + DIR_DATA;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, true);
-       smackManager.AddLabelDir(packageId, destPath);
+       smackManager.SetupPath(packageId, destPath, SMACK_DIR_TYPE_PRIVATE);
 
        return true;
 }
index f663a11..a906a20 100755 (executable)
@@ -47,7 +47,7 @@ public:
 
 private:
        static bool SetSymLink(InstallationContext* pContext);
-    static bool PrepareDataCaging(InstallationContext* pContext);
+  static bool PrepareDataCaging(InstallationContext* pContext);
 
 }; // PermissionManager
 
index 6468190..563c800 100755 (executable)
@@ -71,11 +71,7 @@ SmackManager::Install(const PackageId& packageId)
        TryReturn(pPackageId, false, "pPackageId is null.");
 
        res = Install(pPackageId.get());
-
-       if (__pContext->__isAntiVirus == true)
-       {
-               RegisterAv(pPackageId.get());
-       }
+       TryReturn(res == 0, false, "Install() failed.");
 
        return true;
 }
@@ -115,31 +111,23 @@ SmackManager::AddLabelDir(const String& label, const String& dirPath, bool rootD
        std::unique_ptr<char[]> pRealPath(_StringConverter::CopyToCharArrayN(realPath));
        TryReturn(pRealPath, false, "pRealPath is null");
 
-       if ((rootDirectory == true) || (dirPath.Contains(L"/shared/res") == true))
+       if ((rootDirectory == true) || (realPath.Contains(L"/shared/res") == true))
        {
                res = AddLabelDir("_", pRealPath.get());
        }
-       else if ((dirPath.Contains(L"/shared/data") == true) || (dirPath.Contains(L"/shared/trusted") == true))
-       {
-               AddLabelSharedDir(L"", realPath);
-       }
-       else if (dirPath.Contains(L"shared") == true)
-       {
-               res = AddLabelDir("*", pRealPath.get());
-       }
        else
        {
-               std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(label));
-               TryReturn(pPackageId, false, "pPackageId is null");
+               std::unique_ptr<char[]> pLabel(_StringConverter::CopyToCharArrayN(label));
+               TryReturn(pLabel, false, "pLabel is null.");
 
-               res = AddLabelDir(pPackageId.get(), pRealPath.get());
+               res = AddLabelDir(pLabel.get(), pRealPath.get());
        }
 
        return true;
 }
 
 bool
-SmackManager::AddLabelSymlink(const String& label, const String& symlink)
+SmackManager::AddLabelSymlink(const String& symlink)
 {
        int res = 0;
 
@@ -159,6 +147,7 @@ SmackManager::AddLabelSymlink(const String& label, const String& symlink)
        return true;
 }
 
+#if 0
 bool
 SmackManager::AddLabelSharedDir(const PackageId& packageId, const String& dirPath)
 {
@@ -240,7 +229,9 @@ SmackManager::AddLabelSharedDir(const PackageId& packageId, const String& dirPat
 
        return true;
 }
+#endif
 
+#if 0
 bool
 SmackManager::AddSharedDirReaders(const String& label)
 {
@@ -330,6 +321,7 @@ CATCH:
 
        return res;
 }
+#endif
 
 bool
 SmackManager::AddFriend(const Tizen::App::PackageId& packageId1, const Tizen::App::PackageId& packageId2)
@@ -402,6 +394,97 @@ SmackManager::RevokePermissions(const PackageId& packageId)
        return true;
 }
 
+bool
+SmackManager::SetupPath(const PackageId& packageId, const String& dirPath, SmackDirType type, const String& label)
+{
+       int res = 0;
+       String realPath;
+
+       std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
+       TryReturn(pPackageId, false, "pPackageId is null.");
+
+       std::unique_ptr<char[]> pPath(_StringConverter::CopyToCharArrayN(dirPath));
+       TryReturn(pPath, false, "pPath is null.");
+
+       if (InstallerUtil::IsSymlink(dirPath) == true)
+       {
+               res = SetupPath(pPackageId.get(), pPath.get(), (int) SMACK_DIR_TYPE_ANY_LABEL, "_");
+               InstallerUtil::GetRealPath(dirPath, realPath);
+       }
+       else
+       {
+               realPath = dirPath;
+       }
+
+       std::unique_ptr<char[]> pRealPath(_StringConverter::CopyToCharArrayN(realPath));
+       TryReturn(pRealPath, false, "pRealPath is null.");
+
+       if (type == SMACK_DIR_TYPE_GROUP_RW)
+       {
+               TryReturn(__pContext, false, "__pContext is null.");
+
+               String groupId;
+
+               if (__pContext->__isVerificationMode == true)
+               {
+                       Sha1Hash hash;
+                       String base64Value;
+                       result r = E_SUCCESS;
+
+                       IListT<String *>* pAuthorCertList = __pContext->__pAuthorCertList;
+                       TryReturn(pAuthorCertList, false, "pAuthorCertList is null.");
+
+                       String* pEntity = null;
+                       r = pAuthorCertList->GetAt(0, pEntity);
+                       TryReturn(!IsFailed(r), false, "pAuthorCertList->GetAt() is failed.");
+                       TryReturn(pEntity, false, "pEntity is null.");
+
+                       std::unique_ptr<ByteBuffer> pEncodedData(StringUtil::DecodeBase64StringN(*pEntity));
+                       TryReturn(pEncodedData, false, "pEncodedData is null.");
+
+                       std::unique_ptr<ByteBuffer> pHashValue(hash.GetHashN(*pEncodedData.get()));
+                       TryReturn(pHashValue, false, "pHashValue is null.");
+
+                       r = StringUtil::EncodeToBase64String(*pHashValue, base64Value);
+                       TryReturn(!IsFailed(r), false, "EncodeToBase64String() is failed.");
+
+                       // in smack, '/' is not allowed for label.
+                       r = base64Value.Replace(L"/", L"#");
+                       TryReturn(!IsFailed(r), false, "base64Value.Replace() is failed.");
+
+                       std::unique_ptr<char[]> pHashEncodedValue(_StringConverter::CopyToCharArrayN(base64Value));
+                       TryReturn(pHashEncodedValue, false, "pHashEncodedValue is null.");
+
+                       groupId = pHashEncodedValue.get();
+                       AppLog("pHashEncodedValue = [%s]", pHashEncodedValue.get());
+               }
+               else
+               {
+                       groupId = __pContext->__packageId;
+               }
+
+               std::unique_ptr<char[]> pGroupId(_StringConverter::CopyToCharArrayN(groupId));
+               TryReturn(pGroupId, false, "pGroupId is null.");
+
+               res = SetupPath(pPackageId.get(), pRealPath.get(), (int) type, pGroupId.get());
+       }
+       else if (type == SMACK_DIR_TYPE_ANY_LABEL)
+       {
+               TryReturn(label.IsEmpty() == false, false, "label is empty.");
+
+               std::unique_ptr<char[]> pAnyLabel(_StringConverter::CopyToCharArrayN(label));
+               TryReturn(pAnyLabel, false, "pAnyLabel is null.");
+
+               res = SetupPath(pPackageId.get(), pRealPath.get(), (int) type, pAnyLabel.get());
+       }
+       else
+       {
+               res = SetupPath(pPackageId.get(), pRealPath.get(), (int) type);
+       }
+
+       return true;
+}
+
 int
 SmackManager::Install(const char* pPackageId)
 {
@@ -501,6 +584,7 @@ SmackManager::AddLabelDir(const char* pLabel, const char* pDirPath)
        return 0;
 }
 
+#if 0
 int
 SmackManager::AddLabelSharedDir(const char* pLabel, const char* pSharedLabel, const char* pDirPath)
 {
@@ -533,7 +617,9 @@ SmackManager::AddLabelSharedDir(const char* pLabel, const char* pSharedLabel, co
 
        return 0;
 }
+#endif
 
+#if 0
 int
 SmackManager::AddSharedDirReaders(const char* pSharedLabel, const char** ppAppList)
 {
@@ -566,6 +652,7 @@ SmackManager::AddSharedDirReaders(const char* pSharedLabel, const char** ppAppLi
 
        return 0;
 }
+#endif
 
 int
 SmackManager::AddFriend(const char* pPackageId1, const char* pPackageId2)
@@ -667,37 +754,45 @@ SmackManager::RevokePermissions(const char* pPackageId)
 }
 
 int
-SmackManager::RegisterAv(const char* pPackageId)
+SmackManager::SetupPath(const char* pPackageId, const char* pDirPath, int appPathType, const char* pGroupId)
 {
        int ret = 0;
        void* pHandle = null;
        char* pErrorMsg = null;
-       int (*app_register_av)(const char*) = null;
+       int (*app_setup_path)(const char*, const char*, int, ...) = null;
 
        pHandle = dlopen("libprivilege-control.so.0", RTLD_LAZY | RTLD_GLOBAL);
        if (!pHandle)
        {
-               AppLog("RegisterAv(): dlopen() failed. [%s]", dlerror());
+               AppLog("dlopen() failed. [%s]", dlerror());
                return -1;
        }
 
-       app_register_av = reinterpret_cast <int (*)(const char*)>(dlsym(pHandle, "app_register_av"));
+       app_setup_path = reinterpret_cast <int (*)(const char*, const char*, int, ...)>(dlsym(pHandle, "app_setup_path"));
        pErrorMsg = dlerror();
-       if ((pErrorMsg != null) || (app_register_av == null))
+       if ((pErrorMsg != null) || (app_setup_path == null))
        {
-               AppLog("RegisterAv(): dlsym() failed. [%s]", pErrorMsg);
+               AppLog("dlsym() failed. [%s]", pErrorMsg);
                dlclose(pHandle);
                return -1;
        }
 
-       AppLog("[smack] app_register_av(%s)", pPackageId);
-       ret = app_register_av(pPackageId);
-       AppLog("[smack] app_register_av(%s), result = [%d]", pPackageId, ret);
+       if (pGroupId == null)
+       {
+               AppLog("[smack] app_setup_path(%s, %s, %d)", pPackageId, pDirPath, appPathType);
+               ret = app_setup_path(pPackageId, pDirPath, appPathType);
+               AppLog("[smack] app_setup_path(), result = [%d]", ret);
+       }
+       else
+       {
+               AppLog("[smack] app_setup_path(%s, %s, %d, %s)", pPackageId, pDirPath, appPathType, pGroupId);
+               ret = app_setup_path(pPackageId, pDirPath, appPathType, pGroupId);
+               AppLog("[smack] app_setup_path(), result = [%d]", ret);
+       }
 
        dlclose(pHandle);
 
        return ret;
-
 }
 
 ArrayList*
index 2e6e071..85281c8 100755 (executable)
@@ -38,27 +38,29 @@ public:
        bool Uninstall(const Tizen::App::PackageId& packageId);
 
        bool AddLabelDir(const Tizen::Base::String& label, const Tizen::Base::String& dirPath, bool rootDirectory = false);
-       bool AddLabelSymlink(const Tizen::Base::String& label, const Tizen::Base::String& symlink);
-       bool AddLabelSharedDir(const Tizen::App::PackageId& packageId, const Tizen::Base::String& dirPath);
-       bool AddSharedDirReaders(const Tizen::Base::String& label);
+       bool AddLabelSymlink(const Tizen::Base::String& symlink);
+       //bool AddLabelSharedDir(const Tizen::App::PackageId& packageId, const Tizen::Base::String& dirPath);
+       //bool AddSharedDirReaders(const Tizen::Base::String& label);
        bool AddFriend(const Tizen::App::PackageId& packageId1, const Tizen::App::PackageId& packageId2);
 
        bool EnablePermissions(const Tizen::App::PackageId& packageId);
        bool RevokePermissions(const Tizen::App::PackageId& packageId);
 
+       bool SetupPath(const Tizen::App::PackageId& packageId, const Tizen::Base::String& dirPath, SmackDirType type, const Tizen::Base::String& label = L"");
+
 private:
        int Install(const char* pPackageId);
        int Uninstall(const char* pPackageId);
 
        int AddLabelDir(const char* pLabel, const char* pDirPath);
-       int AddLabelSharedDir(const char* pLabel, const char* pSharedLabel, const char* pDirPath);
-       int AddSharedDirReaders(const char* pSharedLabel, const char** ppAppList);
+       //int AddLabelSharedDir(const char* pLabel, const char* pSharedLabel, const char* pDirPath);
+       //int AddSharedDirReaders(const char* pSharedLabel, const char** ppAppList);
        int AddFriend(const char* pPackageId1, const char* pPackageId2);
 
        int EnablePermissions(const char* pPackageId, int appType, const char** ppPermissions, bool persistent);
        int RevokePermissions(const char* pPackageId);
 
-       int RegisterAv(const char* pPackageId);
+       int SetupPath(const char* pPackageId, const char* pDirPath, int appPathType, const char* pGroupId = null);
 
        Tizen::Base::Collection::ArrayList* GetPreloadedAppListN() const;
 
index 291b652..8abe02c 100755 (executable)
@@ -275,7 +275,7 @@ InstallerUtil::CreateSymlink(const String& oldPath, const String& newPath, bool
        }
        else
        {
-               smackManager.AddLabelSymlink(label, newPath);
+               smackManager.AddLabelSymlink(newPath);
        }
 
        AppLog("CreateSymlink(): [%ls] -> [%ls]", newPath.GetPointer(), oldPath.GetPointer());
index 34a4ef2..e5966e0 100755 (executable)
@@ -1325,11 +1325,6 @@ ManifestHandler::OnCategoryValue(const char* pCharacters)
        {
                __pAppData->__feature = CATEGORY_TYPE_IME;
        }
-       else if (strcasecmp(pCharacters, TIZEN_CATEGORY_ANTIVIRUS) == 0)
-       {
-               AppLog("ANTIVIRUS Package is detected.");
-               __pContext->__isAntiVirus = true;
-       }
 
        return true;
 }