Merge "Match schema file version to db version" into tizen
authorDong Sun Lee <ds73.lee@samsung.com>
Tue, 28 Jul 2015 01:15:04 +0000 (18:15 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 28 Jul 2015 01:15:04 +0000 (18:15 -0700)
src/manager/client/client-manager-impl.cpp
src/manager/service/ckm-logic.cpp

index 3bb1ef9..79774c1 100644 (file)
@@ -573,6 +573,9 @@ int ManagerImpl::getCertificateChain(
     RawBufferVector untrustedVector;
     RawBufferVector trustedVector;
 
+    if(!certificate || certificate->empty())
+        return CKM_API_ERROR_INPUT_PARAM;
+
     for (auto &e: untrustedCertificates) {
         untrustedVector.push_back(e->getDER());
     }
@@ -601,6 +604,9 @@ int ManagerImpl::getCertificateChain(
     LabelNameVector untrustedVector;
     LabelNameVector trustedVector;
 
+    if(!certificate || certificate->empty())
+        return CKM_API_ERROR_INPUT_PARAM;
+
     for (auto &e: untrustedCertificates) {
         AliasSupport helper(e);
         untrustedVector.push_back(std::make_pair(helper.getLabel(), helper.getName()));
index 8197fb9..3ce1e1c 100644 (file)
@@ -1318,10 +1318,18 @@ int CKMLogic::getCertificateChainHelper(
     if (cert.empty())
         return CKM_API_ERROR_INPUT_PARAM;
 
-    for (auto &e: untrustedCertificates)
-        untrustedCertVector.push_back(CertificateImpl(e, DataFormat::FORM_DER));
-    for (auto &e: trustedCertificates)
-        trustedCertVector.push_back(CertificateImpl(e, DataFormat::FORM_DER));
+    for (auto &e: untrustedCertificates) {
+        CertificateImpl c(e, DataFormat::FORM_DER);
+        if(c.empty())
+            return CKM_API_ERROR_INPUT_PARAM;
+        untrustedCertVector.push_back(std::move(c));
+    }
+    for (auto &e: trustedCertificates) {
+        CertificateImpl c(e, DataFormat::FORM_DER);
+        if(c.empty())
+            return CKM_API_ERROR_INPUT_PARAM;
+        trustedCertVector.push_back(std::move(c));
+    }
 
     CertificateStore store;
     int retCode = store.verifyCertificate(cert,