From 68af7c73a13d4cc9dfae76ad1c057cedc0b223f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Thu, 29 Jul 2021 17:14:00 -0400 Subject: [PATCH] certstore: fix id loading Change-Id: If02e9f70726e9506b54d69048a4996f3c1bd3f8f --- src/security/certstore.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/security/certstore.cpp b/src/security/certstore.cpp index 39abe73db1..17e7eb3e80 100644 --- a/src/security/certstore.cpp +++ b/src/security/certstore.cpp @@ -68,11 +68,11 @@ CertificateStore::loadLocalCertificates() try { auto crt = std::make_shared<crypto::Certificate>( fileutils::loadFile(certPath_ + DIR_SEPARATOR_CH + f)); - auto id = crt->getId().toString(); - auto longId = crt->getLongId().toString(); - if (id != f && longId != f) - throw std::logic_error("Certificate id mismatch"); while (crt) { + auto id = crt->getId().toString(); + auto longId = crt->getLongId().toString(); + if (id != f && longId != f) + throw std::logic_error("Certificate id mismatch"); certs_.emplace(std::move(id), crt); certs_.emplace(std::move(longId), crt); loadRevocations(*crt); @@ -80,6 +80,7 @@ CertificateStore::loadLocalCertificates() ++n; } } catch (const std::exception& e) { + JAMI_WARN() << "Remove cert. " << e.what(); remove((certPath_ + DIR_SEPARATOR_CH + f).c_str()); } } @@ -396,7 +397,8 @@ void CertificateStore::pinRevocationList(const std::string& id, const dht::crypto::RevocationList& crl) { fileutils::check_dir((crlPath_ + DIR_SEPARATOR_CH + id).c_str()); - fileutils::saveFile(crlPath_ + DIR_SEPARATOR_CH + id + DIR_SEPARATOR_CH + dht::toHex(crl.getNumber()), + fileutils::saveFile(crlPath_ + DIR_SEPARATOR_CH + id + DIR_SEPARATOR_CH + + dht::toHex(crl.getNumber()), crl.getPacked()); } -- GitLab