Skip to content

Commit

Permalink
Merge pull request #6880 from Icinga/bugfix/pki-requestcertificate-no…
Browse files Browse the repository at this point in the history
…-cert

pki::RequestCertificate: handle missing certificate/CSR
  • Loading branch information
Michael Friedrich authored Jan 9, 2019
2 parents 2e1b6bd + 4a7960f commit e1a941e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/remote/jsonrpcconnection-pki.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit e1a941e

Please sign in to comment.