From ebd03383f856bfaa72b1700a96561396e6f8f6cc Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 19 Feb 2024 18:46:05 +0000 Subject: Allow using multiple SSL fingerprint algorithms. Closes #1804. --- src/modules/m_gateway.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/modules/m_gateway.cpp') diff --git a/src/modules/m_gateway.cpp b/src/modules/m_gateway.cpp index 33e2f10f7..78313dc68 100644 --- a/src/modules/m_gateway.cpp +++ b/src/modules/m_gateway.cpp @@ -107,9 +107,24 @@ public: return false; // Does the user have a valid fingerprint? - const std::string fp = sslapi ? sslapi->GetFingerprint(user) : ""; - if (!fingerprint.empty() && !InspIRCd::TimingSafeCompare(fp, fingerprint)) - return false; + if (!fingerprint.empty()) + { + if (!sslapi) + return false; + + bool okay = false; + for (const auto& fp : sslapi->GetFingerprints(user)) + { + if (InspIRCd::TimingSafeCompare(fp, fingerprint)) + { + okay = true; + break; + } + } + + if (!okay) + return false; + } for (const auto& mask : hostmasks) { -- cgit v1.3.1-10-gc9f91