Fix parsing error and Add root certificate
authorDuyoung Jang <duyoung.jang@samsung.com>
Thu, 3 Jan 2013 05:10:35 +0000 (14:10 +0900)
committerDuyoung Jang <duyoung.jang@samsung.com>
Thu, 3 Jan 2013 05:10:35 +0000 (14:10 +0900)
Change-Id: I7c85349e3e4b486d0fa009dda41733326147ee25
Signed-off-by: Duyoung Jang <duyoung.jang@samsung.com>
inc/InstallerDefs.h
packaging/osp-installer.spec
src/Manager/SignatureManager.cpp
src/XmlHandler/XmlHandler.cpp
src/XmlHandler/XmlHandler.h

index a70a471..34d4c80 100755 (executable)
@@ -21,7 +21,7 @@
 #ifndef _INSTALLER_DEFS_H_
 #define _INSTALLER_DEFS_H_
 
-#define OSP_INSTALLER_VERSION "osp-installer version = [2013/01/03]_[1]"
+#define OSP_INSTALLER_VERSION "osp-installer version = [2013/01/03]_[2]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
index d7a75af..b26e948 100755 (executable)
@@ -3,7 +3,7 @@ Summary:        osp application installer
 Version:       1.2.1.0
 Release:       2
 Group:         TO_BE/FILLED_IN
-License:       TO_BE/FILLED_IN
+License:       Apache License, Version 2.0 or Flora
 Source0:       %{name}-%{version}.tar.gz
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(capi-system-info)
@@ -51,16 +51,8 @@ cp %{_builddir}/%{name}-%{version}/LICENSE  %{buildroot}/usr/share/license/%{nam
 /bin/rm -f /etc/ld.so.cache
 /sbin/ldconfig
 
-rm -f /usr/etc/package-manager/osp-rpm-uninstall.sh
-rm -rf /opt/apps/org.tizen.aospd00043*
-rm -rf /opt/apps/org.tizen.q7097a278m*
-rm -rf /opt/apps/org.tizen.cp7ipabg4k*
-rm -rf /opt/apps/org.tizen.57r43275q7*
-
 mkdir -p /usr/share/packages
 mkdir -p /opt/share/packages
-mkdir -p /opt/osp/system/data/package
-chmod -R 705 /opt/osp/system/data/package
 rm -rf /usr/etc/package-manager/backendlib/libtpk.so
 ln -s /usr/lib/libosp-installer-plugin.so /usr/etc/package-manager/backendlib/libtpk.so
 rm -rf /usr/etc/package-manager/backend/tpk
index 2d37017..cd9c9ea 100755 (executable)
@@ -287,9 +287,60 @@ SignatureManager::AddDistributorRootCert(X509CertificatePath* pCertPath)
                                                "xgUu7B8n7hQeV3EADh6ft/lE8nalzAl9tALTxAmLtYvEYA7thvDoKi1k7bN48izL"
                                                "gS9G4WEAUg==";
                }
-               else
+               else if (certType == ROOT_CERTIFICATE_PARTNER_OPERATOR)
+               {
+                       pRootCert = "MIICzDCCAjWgAwIBAgIJAJrv22F9wyp/MA0GCSqGSIb3DQEBBQUAMIGeMQswCQYD"
+                                                                       "VQQGEwJLUjEOMAwGA1UECAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQK"
+                                                                       "DA1UaXplbiBUZXN0IENBMSIwIAYDVQQLDBlUaXplbiBEaXN0cmlidXRvciBUZXN0"
+                                                                       "IENBMTMwMQYDVQQDDCpUaXplbiBQYXJ0bmVyLU9wZXJhdG9yIERpc3RyaWJ1dG9y"
+                                                                       "IFJvb3QgQ0EwHhcNMTIxMjEzMDUzOTMyWhcNMjIxMjExMDUzOTMyWjCBnjELMAkG"
+                                                                       "A1UEBhMCS1IxDjAMBgNVBAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UE"
+                                                                       "CgwNVGl6ZW4gVGVzdCBDQTEiMCAGA1UECwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVz"
+                                                                       "dCBDQTEzMDEGA1UEAwwqVGl6ZW4gUGFydG5lci1PcGVyYXRvciBEaXN0cmlidXRv"
+                                                                       "ciBSb290IENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9X0Hw0EfAuagg"
+                                                                       "De9h6Jtvh8Df4fyVbvLm9VNea/iVP3/qTbG8tNqoQ32lu0SwzAZBnjpvpbxzsWs9"
+                                                                       "pSYo7Ys1fymHlu+gf+kmTGTVscBrAHWkr4O0m33x2FYfy/wmu+IImnRDYDud83rN"
+                                                                       "tjQmMO6BihN9Lb6kLiEtVIa8ITwdQwIDAQABoxAwDjAMBgNVHRMEBTADAQH/MA0G"
+                                                                       "CSqGSIb3DQEBBQUAA4GBAHS2M2UnfEsZf80/sT84xTcfASXgpFL/1M5HiAVpR+1O"
+                                                                       "UwLpLyqHiGQaASuADDeGEfcIqEf8gP1SzvnAZqLx9GchbOrOKRleooVFH7PRxFBS"
+                                                                       "VWJ5Fq46dJ1mCgTWSkrL6dN5j9hWCzzGfv0Wco+NAf61n9kVbCv7AScIJwQNltOy";
+               }
+               else if (certType == ROOT_CERTIFICATE_PARTNER_MANUFACTURER)
+               {
+                       pRootCert = "MIIC1DCCAj2gAwIBAgIJAJZH47dCtgPdMA0GCSqGSIb3DQEBBQUAMIGiMQswCQYD"
+                                                                       "VQQGEwJLUjEOMAwGA1UECAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQK"
+                                                                       "DA1UaXplbiBUZXN0IENBMSIwIAYDVQQLDBlUaXplbiBEaXN0cmlidXRvciBUZXN0"
+                                                                       "IENBMTcwNQYDVQQDDC5UaXplbiBQYXJ0bmVyLU1hbnVmYWN0dXJlciBEaXN0cmli"
+                                                                       "dXRvciBSb290IENBMB4XDTEyMTIxMzA1NDQxN1oXDTIyMTIxMTA1NDQxN1owgaIx"
+                                                                       "CzAJBgNVBAYTAktSMQ4wDAYDVQQIDAVTdXdvbjEOMAwGA1UEBwwFU3V3b24xFjAU"
+                                                                       "BgNVBAoMDVRpemVuIFRlc3QgQ0ExIjAgBgNVBAsMGVRpemVuIERpc3RyaWJ1dG9y"
+                                                                       "IFRlc3QgQ0ExNzA1BgNVBAMMLlRpemVuIFBhcnRuZXItTWFudWZhY3R1cmVyIERp"
+                                                                       "c3RyaWJ1dG9yIFJvb3QgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMJG"
+                                                                       "0gq3XrDn7W7cIH58w7hSDMVENnXLmXm4Jl5teXXrgL/BgpORracGMgm0Fmxxq/Nq"
+                                                                       "8OEI2RfmtrlN5nWGiphs3XqLHtO+BAPY1BbZS6YVZjrVXrGWdzk12zQxd6sXJMiV"
+                                                                       "B08ECQiQ0qgKFbTDSEbH/p4eyKCMG9lnrBLPHTpJAgMBAAGjEDAOMAwGA1UdEwQF"
+                                                                       "MAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAJTJYCr9GhZ1xXwvxsWLGd9XV9wixo1zk"
+                                                                       "FV2+eJZbCc4xJyOSb0cZds8fYUuzw32oyElLvPhYfAHVTHu/WlkwSshZlKdI2hCT"
+                                                                       "Iy03/Up+JNfuom8JLgF7qc3YtbuJHzoVu1jJ/akXU6y52D/J5CkYy2JSsV0KZuh2"
+                                                                       "ZeRWlV2f1Uo=";
+               }
+               else // ROOT_CERTIFICATE_PRIVATE
                {
-                       pRootCert = "NeedToAddCert";
+                       pRootCert = "MIICujCCAiOgAwIBAgIJAMFWyIhkXFUVMA0GCSqGSIb3DQEBBQUAMIGVMQswCQYD"
+                                                                       "VQQGEwJLUjEOMAwGA1UECAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQK"
+                                                                       "DA1UaXplbiBUZXN0IENBMSIwIAYDVQQLDBlUaXplbiBEaXN0cmlidXRvciBUZXN0"
+                                                                       "IENBMSowKAYDVQQDDCFUaXplbiBQcml2YXRlIERpc3RyaWJ1dG9yIFJvb3QgQ0Ew"
+                                                                       "HhcNMTIxMjEzMDU1MDM2WhcNMjIxMjExMDU1MDM2WjCBlTELMAkGA1UEBhMCS1Ix"
+                                                                       "DjAMBgNVBAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6ZW4g"
+                                                                       "VGVzdCBDQTEiMCAGA1UECwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEqMCgG"
+                                                                       "A1UEAwwhVGl6ZW4gUHJpdmF0ZSBEaXN0cmlidXRvciBSb290IENBMIGfMA0GCSqG"
+                                                                       "SIb3DQEBAQUAA4GNADCBiQKBgQDSqcYGTmYKmsPNB7HJjhobKjaZXtRjmpStN0g5"
+                                                                       "vNnKa2azBMy9uI2DP8b1Qik0Un3jdUcVHNVW6Sf29eUlylB9OGX5e9ss7kk+VJUB"
+                                                                       "l2adTaEJP1Yj8/qghQFf97GJkKZsAZcJyUS57+Ipq4T7g4h+QyGrDw2jPCX9TJx9"
+                                                                       "JmfizwIDAQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAIQc"
+                                                                       "zG1ZlLpyK9uKTkypvpd/rnR0WV9OMR4+74mHfRANZJ+KL9kVjWsWiLJCAbwaauo1"
+                                                                       "E9ta6D8P2V+sfzaJPvTXnobpDb86iNljKGgYjuB0AXoPHf52M0IbZ+YI6Tjj5REa"
+                                                                       "J8LPhyNYjT8xm9435LeDjNvssgXptfaKF0kfZ5NT";
                }
 
                length = strlen(pRootCert);
index b958d7d..75964f0 100755 (executable)
@@ -20,6 +20,7 @@
  */
 
 #include <new>
+#include <unique_ptr.h>
 #include <libxml/parser.h>
 #include <libxml/parserInternals.h>
 #include <libxml/tree.h>
@@ -27,6 +28,7 @@
 
 #include <FBaseLog.h>
 #include <FIoFile.h>
+#include <FBase_StringConverter.h>
 
 #include "InstallerDefs.h"
 #include "XmlHandler.h"
@@ -38,6 +40,7 @@ using namespace Tizen::Io;
 XmlHandler::XmlHandler(void)
 :__pAttr(null)
 ,__pElementName(null)
+,__pCharacters(null)
 ,__error(false)
 {
 }
@@ -150,6 +153,19 @@ XmlHandler::EndElement(void *ctx, const xmlChar *name)
        XmlHandler *pHandler = null;
        pHandler = (XmlHandler *)ctx;
        bool xmlResult = false;
+       String* pCharacters = pHandler->GetCharacters();
+
+       if (pCharacters && (pCharacters->IsEmpty() == false))
+       {
+               std::unique_ptr<char[]> pCharacter(_StringConverter::CopyToCharArrayN(*pCharacters));
+               TryReturnVoid(pCharacter, "pCharacter is null.");
+
+               xmlResult = pHandler->OnCharacters(pCharacter.get());
+               if (xmlResult == false)
+               {
+                       pHandler->SetError();
+               }
+       }
 
        xmlResult = pHandler->OnEndElement((const char *)name);
        if (xmlResult == false)
@@ -161,18 +177,18 @@ XmlHandler::EndElement(void *ctx, const xmlChar *name)
 
        pHandler->DeleteElement();
        pHandler->DeleteAttribute();
+       pHandler->DeleteCharacters();
 }
 
 void
 XmlHandler::Characters(void *ctx, const xmlChar *ch, int len)
 {
-       XmlHandler *pHandler = null;
-       pHandler = (XmlHandler *)ctx;
-       char *pCharacters = null;
-       bool xmlResult = false;
-
        TryReturnVoid(ch, "ch is null.");
 
+       XmlHandler* pHandler = null;
+       pHandler = (XmlHandler*)ctx;
+       char* pCharacters = null;
+
        if (ch[0] == 0x20 || ch[0] == 0x09 || ch[0] == 0x0D || ch[0] == 0x0A)
        {
                return;
@@ -184,11 +200,7 @@ XmlHandler::Characters(void *ctx, const xmlChar *ch, int len)
        strncpy(pCharacters, (const char *)ch, len);
        pCharacters[len] = 0;
 
-       xmlResult = pHandler->OnCharacters(pCharacters);
-       if (xmlResult == false)
-       {
-               pHandler->SetError();
-       }
+       pHandler->SetCharacters(pCharacters);
 
        // AppLogTag(OSP_INSTALLER, "%s", pCharacters);
        delete[] pCharacters;
@@ -387,6 +399,35 @@ XmlHandler::DeleteElement(void)
        __elementStack.Pop();
 }
 
+bool
+XmlHandler::SetCharacters(const char* pCharacter)
+{
+       TryReturn(pCharacter, false, "[osp-installer] pCharacter is null");
+
+       if (__pCharacters == null)
+       {
+               __pCharacters = new (std::nothrow) String(4096);
+               TryReturn(__pCharacters, false, "[osp-installer] __pCharacters is null");
+       }
+
+       __pCharacters->Append(pCharacter);
+
+       return true;
+}
+
+String*
+XmlHandler::GetCharacters(void)
+{
+       return __pCharacters;
+}
+
+void
+XmlHandler::DeleteCharacters(void)
+{
+       delete __pCharacters;
+       __pCharacters = null;
+}
+
 void
 XmlHandler::SetAttribute(XmlAttribute *pAttr)
 {
index 1a4ed3b..7c25b83 100755 (executable)
@@ -77,6 +77,10 @@ protected:
        bool SetElementName(const char *pElementName);
        void DeleteElement(void);
 
+       bool SetCharacters(const char* pCharacter);
+       Tizen::Base::String* GetCharacters(void);
+       void DeleteCharacters(void);
+
        void SetAttribute(XmlAttribute *pAttr);
        void DeleteAttribute(void);
 
@@ -92,6 +96,7 @@ private:
 
        XmlAttribute* __pAttr;
        char* __pElementName;
+       Tizen::Base::String* __pCharacters;
        Tizen::Base::Collection::Stack __elementStack;
 
        bool __error;