Fix cloaking users with a non-IP hostname when using hmac-sha256-ip.

This commit is contained in:
Sadie Powell 2023-01-15 21:11:43 +00:00
parent 7dbc0f8208
commit 9109587ed2
2 changed files with 6 additions and 5 deletions

View File

@ -136,6 +136,10 @@ public:
const std::string cloak = cloakmethod->Generate(user);
if (!cloak.empty())
cloaks->push_back(cloak);
ServerInstance->Logs.Debug(MODNAME, "Cloaked %s (%s/%s) as %s using the %s method.",
user->uuid.c_str(), user->GetIPString().c_str(), user->GetRealHost().c_str(),
cloak.c_str(), cloakmethod->GetName());
}
ext.Set(user, cloaks);
}

View File

@ -214,13 +214,10 @@ public:
return {};
irc::sockets::sockaddrs sa(false);
if (sa.from(user->GetRealHost()) && sa.addr() == user->client_sa.addr())
if (!cloakhost || (sa.from(user->GetRealHost()) && sa.addr() == user->client_sa.addr()))
return CloakAddress(user->client_sa);
if (cloakhost)
return CloakHost(user->GetRealHost(), '.');
return {}; // Only reachable on hmac-sha256-ip.
return CloakHost(user->GetRealHost(), '.');
}
std::string Generate(const std::string& hostip) override