From 79f215606dae66367277012b394009542e4f51a4 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 26 Feb 2024 21:50:15 +0000 Subject: Allow using more than one fingerprint in an oper block. Closes #362. --- src/config.cpp | 2 +- src/users.cpp | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/config.cpp b/src/config.cpp index 99720ef2e..eb037c76a 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -319,7 +319,7 @@ Conf::Conf() : Block("") auto *o = new Oper(nname, ot); o->require_oper = require_oper; o->password = password; - o->certfp = certfp; + spacesepstream(certfp).GetTokens(o->certfp); spacesepstream(host).GetTokens(o->hosts); o->vhost = vhost; diff --git a/src/users.cpp b/src/users.cpp index 7761cb5c7..075f6c157 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -471,9 +471,20 @@ bool User::IsServicesOper() return false; else if (this->nc->o->require_oper && !this->HasMode("OPER")) return false; - else if (!this->nc->o->certfp.empty() && this->fingerprint != this->nc->o->certfp) - // Certfp mismatch - return false; + else if (!this->nc->o->certfp.empty()) + { + bool match = false; + for (const auto &certfp : this->nc->o->certfp) + { + if (this->fingerprint == certfp) + { + match = true; + break; + } + } + if (!match) + return false; + } else if (!this->nc->o->hosts.empty()) { bool match = false; -- cgit