From 62b657d75b4830326f1d0cd99d838ba6a40bacb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Wed, 26 Jul 2023 14:18:56 -0400 Subject: [PATCH] ConnectionManager: allow self-signed certificate Change-Id: I10999a2126a6ee0ed1fbc0d9edcef963a6e6c261 --- src/connectionmanager.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp index 7243f53..70d48e4 100644 --- a/src/connectionmanager.cpp +++ b/src/connectionmanager.cpp @@ -1503,11 +1503,11 @@ ConnectionManager::Impl::foundPeerDevice(const std::shared_ptr<dht::crypto::Cert top_issuer = top_issuer->issuer; // Device certificate can't be self-signed - if (top_issuer == crt) { + /* if (top_issuer == crt) { if (logger) logger->warn("Found invalid (self-signed) peer device: {}", crt->getLongId()); return false; - } + } */ // Check peer certificate chain // Trust store with top issuer as the only CA @@ -1526,12 +1526,14 @@ ConnectionManager::Impl::foundPeerDevice(const std::shared_ptr<dht::crypto::Cert return false; } - account_id = crt->issuer->getId(); - if (logger) - logger->warn("Found peer device: {} account:{} CA:{}", - crt->getLongId(), - account_id, - top_issuer->getId()); + if (auto issuer = crt->issuer) { + account_id = issuer->getId(); + if (logger) + logger->warn("Found peer device: {} account:{} CA:{}", + crt->getLongId(), + account_id, + top_issuer->getId()); + } return true; } -- GitLab