From 9d89d8233df4dd9616c4ff93910ad62bf2551205 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 10 Sep 2025 12:30:45 +0100 Subject: [PATCH] Modernize the ns_sasl_plain module slightly. --- modules/nickserv/ns_sasl_plain.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/nickserv/ns_sasl_plain.cpp b/modules/nickserv/ns_sasl_plain.cpp index 26d5b8a62..68fbd0ec6 100644 --- a/modules/nickserv/ns_sasl_plain.cpp +++ b/modules/nickserv/ns_sasl_plain.cpp @@ -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;