1
0
mirror of https://github.com/anope/anope.git synced 2026-07-10 22:03:13 +02:00

Modernize the ns_sasl_plain module slightly.

This commit is contained in:
Sadie Powell
2025-09-10 12:30:45 +01:00
parent 6f27418381
commit 9d89d8233d
+6 -7
View File
@@ -99,25 +99,24 @@ public:
else if (m.type == "C")
{
// message = [authzid] UTF8NUL authcid UTF8NUL passwd
auto message = Anope::B64Decode(m.data[0]);
const auto message = Anope::B64Decode(m.data[0]);
size_t zcsep = message.find('\0');
const auto zcsep = message.find('\0');
if (zcsep == Anope::string::npos)
return false;
size_t cpsep = message.find('\0', zcsep + 1);
const auto cpsep = message.find('\0', zcsep + 1);
if (cpsep == Anope::string::npos)
return false;
Anope::string authzid = message.substr(0, zcsep);
Anope::string authcid = message.substr(zcsep + 1, cpsep - zcsep - 1);
const auto authzid = message.substr(0, zcsep);
const auto authcid = message.substr(zcsep + 1, cpsep - zcsep - 1);
// We don't support having an authcid that is different to the authzid.
if (!authzid.empty() && authzid != authcid)
return false;
Anope::string passwd = message.substr(cpsep + 1);
const auto passwd = message.substr(cpsep + 1);
if (authcid.empty() || passwd.empty() || !IRCD->IsNickValid(authcid) || passwd.find_first_of("\r\n\0") != Anope::string::npos)
return false;