Modify to check verification mode
authorDuyoung Jang <duyoung.jang@samsung.com>
Tue, 20 Nov 2012 09:36:52 +0000 (18:36 +0900)
committerDuyoung Jang <duyoung.jang@samsung.com>
Tue, 20 Nov 2012 09:36:52 +0000 (18:36 +0900)
Change-Id: I29f908914fdeb530f337aa7f4894265083f0b01d

inc/InstallerDefs.h
src/Context/InstallationContext.cpp
src/Context/InstallationContext.h
src/Step/PackageCheckStep.cpp
src/Step/SignatureStep.cpp
src/XmlHandler/ManifestHandler.cpp

index 781ff82..c3f9104 100755 (executable)
@@ -21,7 +21,7 @@
 #ifndef _INSTALLER_DEFS_H_
 #define _INSTALLER_DEFS_H_
 
-#define OSP_INSTALLER_VERSION "osp-installer version = [2012/11/19]_RC[1]"
+#define OSP_INSTALLER_VERSION "osp-installer version = [2012/11/20]_RC[1]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
index 6b00330..c3d30a6 100755 (executable)
@@ -48,6 +48,7 @@ InstallationContext::InstallationContext(void)
 ,__continue(true)
 ,__preloaded(false)
 ,__hybridService(false)
+,__verificationMode(false)
 ,__operation(INSTALLER_OPERATION_INSTALL)
 ,__storage(INSTALLATION_STORAGE_INTERNAL)
 ,__pPrivilegeList(null)
@@ -275,6 +276,18 @@ InstallationContext::SetHybridService(bool hybridService)
        __hybridService = hybridService;
 }
 
+bool
+InstallationContext::IsVerificationMode(void)
+{
+       return __verificationMode;
+}
+
+void
+InstallationContext::SetVerificationMode(bool verificationMode)
+{
+       __verificationMode = verificationMode;
+}
+
 const String&
 InstallationContext::GetPackagePath(void) const
 {
index 3315496..1a62672 100755 (executable)
@@ -87,6 +87,9 @@ public:
        bool IsHybridService(void);
        void SetHybridService(bool hybridService);
 
+       bool IsVerificationMode(void);
+       void SetVerificationMode(bool verificationMode);
+
        const Osp::Base::String& GetPackagePath(void) const;
        void SetPackagePath(const Osp::Base::String& packagePath);
 
@@ -152,6 +155,7 @@ private:
        bool __continue;
        bool __preloaded;
        bool __hybridService;
+       bool __verificationMode;
 
        Osp::Base::String __inputPath;
        InstallerOperation __operation;
index c005fde..49a77d5 100755 (executable)
@@ -131,8 +131,16 @@ PackageCheckStep::OnStatePackageCheck(void)
        AppLogTag(OSP_INSTALLER, "UnzipTo(manifest.xml) - START");
        unzipper.UnzipTo(tempDir, L"info/manifest.xml");
        unzipper.UnzipTo(tempDir, L"signature1.xml");
+       unzipper.UnzipTo(tempDir, L"author-signature.xml");
        AppLogTag(OSP_INSTALLER, "UnzipTo(manifest.xml) - END");
 
+       if ((File::IsFileExist(__pContext->GetSignatureXmlPath()) == true) &&
+                       (File::IsFileExist(__pContext->GetAuthorSignatureXmlPath()) == true))
+       {
+               AppLogTag(OSP_INSTALLER, "[VerifySignature] VerificationMode ON");
+               __pContext->SetVerificationMode(true);
+       }
+
        GoNextState();
        return error;
 }
index c6e7d7a..536f88d 100755 (executable)
@@ -55,12 +55,7 @@ SignatureStep::Run(InstallationContext* pContext)
 
        __pContext = pContext;
 
-       // signature.xml for beta
-       FileAttributes attr;
-       result r = E_SUCCESS;
-
-       r = File::GetAttributes(__pContext->GetSignatureXmlPath(), attr);
-       if (r != E_SUCCESS)
+       if (__pContext->IsVerificationMode() == false)
        {
                AppLogTag(OSP_INSTALLER, "Signature file not found. path = [%ls]\n", __pContext->GetSignatureXmlPath().GetPointer());
                return INSTALLER_ERROR_NONE;
index c7a8503..fd1115c 100755 (executable)
@@ -394,15 +394,11 @@ ManifestHandler::OnPrivilegesElement(void)
 bool
 ManifestHandler::OnPrivilegesEndElement(void)
 {
-       // signature.xml for beta
-       FileAttributes attr;
-       result r = E_SUCCESS;
-
-       r = File::GetAttributes(__pContext->GetSignatureXmlPath(), attr);
-       if (r != E_SUCCESS)
+       if (__pContext->IsVerificationMode() == false)
        {
                AppLogTag(OSP_INSTALLER, "Signature file not found. [%ls]\n", __pContext->GetSignatureXmlPath().GetPointer());
 
+               result r = E_SUCCESS;
                String privileges;
                String hmacPrivileges;
                String appId = __pPackageInfoImpl->GetAppId();