From: Soyoung Kim Date: Wed, 17 Apr 2013 05:51:43 +0000 (+0900) Subject: Fixed crash during saving certificate. X-Git-Tag: accepted/tizen_2.1/20130425.023916~7^2~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f28e225459f7b1e756f31563431674c949767bc7;hp=3d7fda6b61d523969d9810db83b15e63fbb3075e;p=framework%2Fweb%2Fwrt-installer.git Fixed crash during saving certificate. [Issue#] N/A [Problem] fail during saving certificate. [Cause] there is bug at set certificate. [Solution] null check during set certificate. [SCMRequest] N/A Change-Id: I06e7dbb47dd7040ba416114ba3e2e1a3edc9668a --- diff --git a/src/jobs/widget_install/task_certificates.cpp b/src/jobs/widget_install/task_certificates.cpp index 04247fa..a6693bc 100644 --- a/src/jobs/widget_install/task_certificates.cpp +++ b/src/jobs/widget_install/task_certificates.cpp @@ -91,6 +91,7 @@ void TaskCertificates::SetCertiInfo(CertificateSource source) LogDebug("Insert certinfo to pkgmgr structure"); ValidationCore::CertificateCollection chain; + if (false == chain.load(*it)) { LogError("Chain is broken"); ThrowMsg(Exceptions::SetCertificateInfoFailed, @@ -108,11 +109,17 @@ void TaskCertificates::SetCertiInfo(CertificateSource source) pkgmgr_instcert_type instCertType; if (source == SIGNATURE_DISTRIBUTOR) { - std::string - Name(DPL::ToUTF8String(*(*certIt)->getOrganizationName())); - size_t found = Name.find("Tizen"); + bool distributor1 = false; + if (!(*certIt)->getCommonName().IsNull()) { + std::string + Name(DPL::ToUTF8String(*(*certIt)->getCommonName())); + std::string tizenStr("Tizen"); + if (0 == Name.compare(0, tizenStr.length(), tizenStr)) { + distributor1 = true; + } + } - if (found != std::string::npos) { + if (distributor1) { LogDebug("Set SIGNATURE_DISTRIBUTOR"); if ((*certIt)->isRootCert()) { instCertType = PM_SET_DISTRIBUTOR_ROOT_CERT;