summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDuyoung Jang <duyoung.jang@samsung.com>2013-01-03 14:10:35 +0900
committerDuyoung Jang <duyoung.jang@samsung.com>2013-01-03 14:10:35 +0900
commit1ebb0063b31e94865c040e494d9f4c77d03e67fa (patch)
tree4b10293fe62832f2358f6cd67ec248f283072ecc /src
parentd022ec4cda436708492eca82f2af43f290fe1f26 (diff)
downloadinstaller-1ebb0063b31e94865c040e494d9f4c77d03e67fa.tar.gz
installer-1ebb0063b31e94865c040e494d9f4c77d03e67fa.tar.bz2
installer-1ebb0063b31e94865c040e494d9f4c77d03e67fa.zip
Fix parsing error and Add root certificate
Change-Id: I7c85349e3e4b486d0fa009dda41733326147ee25 Signed-off-by: Duyoung Jang <duyoung.jang@samsung.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/Manager/SignatureManager.cpp55
-rwxr-xr-xsrc/XmlHandler/XmlHandler.cpp61
-rwxr-xr-xsrc/XmlHandler/XmlHandler.h5
3 files changed, 109 insertions, 12 deletions
diff --git a/src/Manager/SignatureManager.cpp b/src/Manager/SignatureManager.cpp
index 2d37017..cd9c9ea 100755
--- a/src/Manager/SignatureManager.cpp
+++ b/src/Manager/SignatureManager.cpp
@@ -287,9 +287,60 @@ SignatureManager::AddDistributorRootCert(X509CertificatePath* pCertPath)
"xgUu7B8n7hQeV3EADh6ft/lE8nalzAl9tALTxAmLtYvEYA7thvDoKi1k7bN48izL"
"gS9G4WEAUg==";
}
- else
+ else if (certType == ROOT_CERTIFICATE_PARTNER_OPERATOR)
+ {
+ pRootCert = "MIICzDCCAjWgAwIBAgIJAJrv22F9wyp/MA0GCSqGSIb3DQEBBQUAMIGeMQswCQYD"
+ "VQQGEwJLUjEOMAwGA1UECAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQK"
+ "DA1UaXplbiBUZXN0IENBMSIwIAYDVQQLDBlUaXplbiBEaXN0cmlidXRvciBUZXN0"
+ "IENBMTMwMQY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"
+ "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);
diff --git a/src/XmlHandler/XmlHandler.cpp b/src/XmlHandler/XmlHandler.cpp
index b958d7d..75964f0 100755
--- a/src/XmlHandler/XmlHandler.cpp
+++ b/src/XmlHandler/XmlHandler.cpp
@@ -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)
{
diff --git a/src/XmlHandler/XmlHandler.h b/src/XmlHandler/XmlHandler.h
index 1a4ed3b..7c25b83 100755
--- a/src/XmlHandler/XmlHandler.h
+++ b/src/XmlHandler/XmlHandler.h
@@ -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;