pki::RequestCertificate: handle missing certificate/CSR

This commit is contained in:
Alexander A. Klimov 2019-01-08 11:49:44 +01:00
parent b46c3c11bb
commit 4a7960f21b
1 changed files with 9 additions and 0 deletions

View File

@ -52,6 +52,15 @@ Value RequestCertificateHandler(const MessageOrigin::Ptr& origin, const Dictiona
else
cert = StringToCertificate(certText);
if (!cert) {
Log(LogWarning, "JsonRpcConnection") << "No certificate or CSR received";
result->Set("status_code", 1);
result->Set("error", "No certificate or CSR received.");
return result;
}
ApiListener::Ptr listener = ApiListener::GetInstance();
std::shared_ptr<X509> cacert = GetX509Certificate(listener->GetDefaultCaPath());