From 54f46172d7493006f44ebab46838eb8ec6844f41 Mon Sep 17 00:00:00 2001 From: Duyoung Jang Date: Thu, 28 Mar 2013 10:14:43 +0900 Subject: [PATCH] VerifyChain() is added for preloaded app. Change-Id: Ifb2bae07ff3db7df9a703d9e8cb4cf8eb9f78173 Signed-off-by: Duyoung Jang --- inc/InstallerDefs.h | 2 +- src/Context/InstallationContextData.cpp | 24 ++++++++++++------------ src/Context/InstallationContextData.h | 3 ++- src/Manager/DatabaseManager.cpp | 2 +- src/Step/PackageCheckStep.cpp | 15 +++++++++++---- src/Step/UnpackStep.cpp | 3 ++- 6 files changed, 29 insertions(+), 20 deletions(-) diff --git a/inc/InstallerDefs.h b/inc/InstallerDefs.h index e7478a5..428c35f 100755 --- a/inc/InstallerDefs.h +++ b/inc/InstallerDefs.h @@ -23,7 +23,7 @@ #include "InstallerUtil.h" -#define OSP_INSTALLER_VERSION "version=[20130326.2]" +#define OSP_INSTALLER_VERSION "version=[20130328.1]" #define DIR_BIN L"/bin" #define DIR_INFO L"/info" diff --git a/src/Context/InstallationContextData.cpp b/src/Context/InstallationContextData.cpp index b93f160..26d4819 100755 --- a/src/Context/InstallationContextData.cpp +++ b/src/Context/InstallationContextData.cpp @@ -436,9 +436,9 @@ AppData::AppData() ,__pSubModeAppControlDataList(null) ,__pNameList(null) ,__pFeatureList(null) -,__pLaunchConditionList(null) ,__pNotificationMap(null) ,__pMetadataMap(null) +,__pLaunchConditionList(null) ,__feature(0) ,__isSubMode(false) ,__legacyAppControls(false) @@ -497,12 +497,6 @@ AppData::~AppData() delete __pFeatureList; } - if (__pLaunchConditionList) - { - __pLaunchConditionList->RemoveAll(); - delete __pLaunchConditionList; - } - if (__pNotificationMap) { __pNotificationMap->RemoveAll(); @@ -514,6 +508,12 @@ AppData::~AppData() __pMetadataMap->RemoveAll(); delete __pMetadataMap; } + + if (__pLaunchConditionList) + { + __pLaunchConditionList->RemoveAll(); + delete __pLaunchConditionList; + } } InstallerError @@ -549,11 +549,6 @@ AppData::Construct(void) r = __pFeatureList->Construct(); TryReturn(!IsFailed(r), INSTALLER_ERROR_OUT_OF_MEMORY, "__pFeatureList->Construct() failed."); - __pLaunchConditionList = new (std::nothrow) HashMap(SingleObjectDeleter); - TryReturn(__pLaunchConditionList, INSTALLER_ERROR_OUT_OF_MEMORY, "__pLaunchConditionList is null."); - r = __pLaunchConditionList->Construct(); - TryReturn(!IsFailed(r), INSTALLER_ERROR_OUT_OF_MEMORY, "__pLaunchConditionList->Construct() failed."); - __pNotificationMap = new (std::nothrow) HashMap(SingleObjectDeleter); TryReturn(__pNotificationMap, INSTALLER_ERROR_OUT_OF_MEMORY, "__pNotificationMap is null."); r = __pNotificationMap->Construct(); @@ -564,5 +559,10 @@ AppData::Construct(void) r = __pMetadataMap->Construct(); TryReturn(!IsFailed(r), INSTALLER_ERROR_OUT_OF_MEMORY, "__pMetadataMap->Construct() failed."); + __pLaunchConditionList = new (std::nothrow) MultiHashMap(SingleObjectDeleter); + TryReturn(__pLaunchConditionList, INSTALLER_ERROR_OUT_OF_MEMORY, "__pLaunchConditionList is null."); + r = __pLaunchConditionList->Construct(); + TryReturn(!IsFailed(r), INSTALLER_ERROR_OUT_OF_MEMORY, "__pLaunchConditionList->Construct() failed."); + return INSTALLER_ERROR_NONE; } diff --git a/src/Context/InstallationContextData.h b/src/Context/InstallationContextData.h index 58508a4..ec8fddc 100755 --- a/src/Context/InstallationContextData.h +++ b/src/Context/InstallationContextData.h @@ -268,10 +268,11 @@ public: Tizen::Base::Collection::HashMap* __pNameList; Tizen::Base::Collection::HashMap* __pFeatureList; - Tizen::Base::Collection::HashMap* __pLaunchConditionList; Tizen::Base::Collection::HashMap* __pNotificationMap; Tizen::Base::Collection::HashMap* __pMetadataMap; + Tizen::Base::Collection::MultiHashMap* __pLaunchConditionList; + int __feature; bool __isSubMode; diff --git a/src/Manager/DatabaseManager.cpp b/src/Manager/DatabaseManager.cpp index a1253ff..32db552 100755 --- a/src/Manager/DatabaseManager.cpp +++ b/src/Manager/DatabaseManager.cpp @@ -285,7 +285,7 @@ DatabaseManager::RegisterLaunchConditionList(AppData* pAppData, Database& db) co TryReturn(pAppData->__pLaunchConditionList, E_SYSTEM, "__pLaunchConditionList is null."); result r = E_SUCCESS; - HashMap* pList = pAppData->__pLaunchConditionList; + MultiHashMap* pList = pAppData->__pLaunchConditionList; std::unique_ptr< IMapEnumerator > pEnum(pList->GetMapEnumeratorN()); TryReturn(pEnum, false, "GetMapEnumeratorN() failed. [%s]", GetErrorMessage(GetLastResult())); diff --git a/src/Step/PackageCheckStep.cpp b/src/Step/PackageCheckStep.cpp index 839be4c..f913133 100755 --- a/src/Step/PackageCheckStep.cpp +++ b/src/Step/PackageCheckStep.cpp @@ -91,6 +91,7 @@ InstallerError PackageCheckStep::OnStatePackageCheck(void) { InstallerError error = INSTALLER_ERROR_NONE; + result r = E_SUCCESS; String tempDir; if (__pContext->__storage == INSTALLATION_STORAGE_INTERNAL) @@ -106,7 +107,6 @@ PackageCheckStep::OnStatePackageCheck(void) if (File::IsFileExist(DIR_OSP_APPLICATIONS_TEMP) == false) { - result r = E_SUCCESS; r = Directory::Create(DIR_OSP_APPLICATIONS_TEMP, false); TryReturn(!IsFailed(r), INSTALLER_ERROR_INTERNAL_STATE, "Directory::Create() failed"); } @@ -123,9 +123,16 @@ PackageCheckStep::OnStatePackageCheck(void) unzipper.Construct(packagePath); AppLog("UnzipTo(manifest.xml) - START"); - unzipper.UnzipTo(tempDir, L"info/manifest.xml"); - unzipper.UnzipTo(tempDir, L"signature1.xml"); - unzipper.UnzipTo(tempDir, L"author-signature.xml"); + + r = unzipper.UnzipTo(tempDir, L"info/manifest.xml"); + TryReturn(!IsFailed(r), INSTALLER_ERROR_PACKAGE_INVALID, "UnzipTo(manifest.xml) failed."); + + r = unzipper.UnzipTo(tempDir, L"signature1.xml"); + //TryReturn(!IsFailed(r), INSTALLER_ERROR_PACKAGE_INVALID, "UnzipTo(signature1.xml) failed."); + + r = unzipper.UnzipTo(tempDir, L"author-signature.xml"); + //TryReturn(!IsFailed(r), INSTALLER_ERROR_PACKAGE_INVALID, "UnzipTo(author-signature.xml) failed."); + AppLog("UnzipTo(manifest.xml) - END"); if ((File::IsFileExist(__pContext->GetSignatureXmlPath()) == true) && diff --git a/src/Step/UnpackStep.cpp b/src/Step/UnpackStep.cpp index 31e3aaa..65afb79 100755 --- a/src/Step/UnpackStep.cpp +++ b/src/Step/UnpackStep.cpp @@ -179,7 +179,8 @@ UnpackStep::OnUnzip(void) } AppLog("UnzipTo - START"); - unzipper.UnzipTo(newInstallPath); + r = unzipper.UnzipTo(newInstallPath); + TryReturn(!IsFailed(r), INSTALLER_ERROR_OUT_OF_STORAGE, "UnzipTo(%ls) failed.", newInstallPath.GetPointer()); AppLog("UnzipTo - END"); // GoNextState(); -- 2.7.4