Enable limiting authority certificates amount.
This patch enables check about authority certificates amount limit
and disallows to install new certificate in case limit violation.
Tested: Tests were performed manually by trying to install dozen
authority certificates over RedFish.
Signed-off-by: Zbigniew Lukwinski <zbigniew.lukwinski@linux.intel.com>
Change-Id: Iea83f05e7b6b0ad3e32bc3f2aba710de863b6d34
diff --git a/certs_manager.cpp b/certs_manager.cpp
index 76ce09f..e1774b6 100644
--- a/certs_manager.cpp
+++ b/certs_manager.cpp
@@ -118,6 +118,11 @@
{
elog<NotAllowed>(Reason("Certificate already exist"));
}
+ else if (certType == phosphor::certs::AUTHORITY &&
+ installedCerts.size() >= AUTHORITY_CERTIFICATES_LIMIT)
+ {
+ elog<NotAllowed>(Reason("Certificates limit reached"));
+ }
auto certObjectPath = objectPath + '/' + std::to_string(certIdCounter++);