aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-08-26 18:17:22 +0100
committerGravatar Sadie Powell2021-08-26 18:17:22 +0100
commit2cfd1708d552195022e6567a156bec3a00ba7630 (patch)
treede8a36a9336e67d20b1f820e8816cb765042aa3b /src/modules
parentFix missing argument to WriteToSnoMask. (diff)
Always respect the host field when automatically logging in opers.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_sslinfo.cpp28
1 files changed, 10 insertions, 18 deletions
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp
index 36fe7fdc8..9d46ee62c 100644
--- a/src/modules/m_sslinfo.cpp
+++ b/src/modules/m_sslinfo.cpp
@@ -373,27 +373,19 @@ class ModuleSSLInfo
return;
// Find an auto-oper block for this user
- for (const auto& [_, ifo] : ServerInstance->Config->oper_blocks)
+ for (const auto& [_, info] : ServerInstance->Config->oper_blocks)
{
- std::string fp = ifo->oper_block->getString("fingerprint");
- if (!MatchFP(cert, fp))
- continue;
+ auto oper = info->oper_block;
+ if (!oper->getBool("autologin"))
+ continue; // No autologin for this block.
- bool do_login = false;
- const std::string autologin = ifo->oper_block->getString("autologin");
- if (stdalgo::string::equalsci(autologin, "if-host-match"))
- {
- const std::string& userHost = localuser->MakeHost();
- const std::string& userIP = localuser->MakeHostIP();
- do_login = InspIRCd::MatchMask(ifo->oper_block->getString("host"), userHost, userIP);
- }
- else if (ifo->oper_block->getBool("autologin"))
- {
- do_login = true;
- }
+ if (!InspIRCd::MatchMask(oper->getString("host"), localuser->MakeHost(), localuser->MakeHostIP()))
+ continue; // Host doesn't match.
+
+ if (!MatchFP(cert, oper->getString("fingerprint")))
+ continue; // Fingerprint doesn't match.
- if (do_login)
- user->Oper(ifo);
+ user->Oper(info);
}
}