From 7ec34045f5ffbd548ddb72a712a0b175b953ffee Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 24 Jun 2026 03:40:44 +0100 Subject: Move the challenge out of CAPAB CAPABILITIES into its own command. --- modules/spanningtree/hmac.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'modules/spanningtree/hmac.cpp') diff --git a/modules/spanningtree/hmac.cpp b/modules/spanningtree/hmac.cpp index 17d22e96f..2b4a2eef2 100644 --- a/modules/spanningtree/hmac.cpp +++ b/modules/spanningtree/hmac.cpp @@ -59,7 +59,13 @@ std::string TreeSocket::MakePass(const std::string& password, const std::string& */ auto* sha256 = ServerInstance->Modules.FindDataService("Hash::Provider", "sha256"); if (sha256 && !challenge.empty()) - return "AUTH:" + Base64::Encode(Hash::HMAC(sha256, password, challenge)); + { + const auto hmac = Hash::HMAC(sha256, password, challenge); + if (proto_version >= PROTO_INSPIRCD_5) + return FMT::format("$hmac-sha256:{}", Percent::Encode(hmac)); + else + return FMT::format("AUTH:{}", Base64::Encode(hmac)); + } if (!challenge.empty() && !sha256) ServerInstance->Logs.Warning(MODNAME, "Not authenticating to server using HMAC-SHA256 because we don't have an SHA256 provider (e.g. the sha2 module) loaded!"); -- cgit v1.3.1-10-gc9f91