diff options
| author | Sadie Powell <sadie@witchery.services> | 2023-11-14 15:02:04 +0000 |
|---|---|---|
| committer | Sadie Powell <sadie@witchery.services> | 2023-11-14 15:02:04 +0000 |
| commit | b28180d680f974b7d3cf72667681b8cda6a39b0a (patch) | |
| tree | 45ce01374a4eb95c7b9bca73f25bc28dfefb2721 /modules/protocol | |
| parent | 0f1f0c5a221d199fefc38e116a98fb4ff2c0a4f3 (diff) | |
Implement support for the ANONYMOUS SASL mechanism.
Diffstat (limited to 'modules/protocol')
| -rw-r--r-- | modules/protocol/inspircd.cpp | 32 | ||||
| -rw-r--r-- | modules/protocol/solanum.cpp | 10 | ||||
| -rw-r--r-- | modules/protocol/unrealircd.cpp | 14 |
3 files changed, 35 insertions, 21 deletions
diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp index e76d745e3..3183e59ee 100644 --- a/modules/protocol/inspircd.cpp +++ b/modules/protocol/inspircd.cpp @@ -75,6 +75,7 @@ class InspIRCdProto : public IRCDProto CanSQLineChannel = true; CanSZLine = true; CanSVSHold = true; + CanSVSLogout = true; CanCertFP = true; CanSendTags = true; RequiresID = true; @@ -461,27 +462,30 @@ class InspIRCdProto : public IRCDProto { SendAccount(uid, na); - if (!na->GetVhostIdent().empty()) - UplinkSocket::Message(Me) << "ENCAP " << uid.substr(0, 3) << " CHGIDENT " << uid << " " << na->GetVhostIdent(); - if (!na->GetVhostHost().empty()) - UplinkSocket::Message(Me) << "ENCAP " << uid.substr(0, 3) << " CHGHOST " << uid << " " << na->GetVhostHost(); - - SASLUser su; - su.uid = uid; - su.acc = na->nc->display; - su.created = Anope::CurTime; - - for (std::list<SASLUser>::iterator it = saslusers.begin(); it != saslusers.end();) + // Expire old pending sessions or other sessions for this user. + for (auto it = saslusers.begin(); it != saslusers.end(); ) { - SASLUser &u = *it; - + const SASLUser &u = *it; if (u.created + 30 < Anope::CurTime || u.uid == uid) it = saslusers.erase(it); else ++it; } - saslusers.push_back(su); + if (na) + { + if (!na->GetVhostIdent().empty()) + UplinkSocket::Message(Me) << "ENCAP " << uid.substr(0, 3) << " CHGIDENT " << uid << " " << na->GetVhostIdent(); + if (!na->GetVhostHost().empty()) + UplinkSocket::Message(Me) << "ENCAP " << uid.substr(0, 3) << " CHGHOST " << uid << " " << na->GetVhostHost(); + + // Mark this SASL session as pending user introduction. + SASLUser su; + su.uid = uid; + su.acc = na->nc->display; + su.created = Anope::CurTime; + saslusers.push_back(su); + } } bool IsExtbanValid(const Anope::string &mask) override diff --git a/modules/protocol/solanum.cpp b/modules/protocol/solanum.cpp index 1ba740d04..c01c4f551 100644 --- a/modules/protocol/solanum.cpp +++ b/modules/protocol/solanum.cpp @@ -43,6 +43,7 @@ class SolanumProto : public IRCDProto CanSZLine = true; CanSVSNick = true; CanSVSHold = true; + CanSVSLogout = true; CanSetVHost = true; RequiresID = true; MaxModes = 4; @@ -158,8 +159,13 @@ class SolanumProto : public IRCDProto void SendSVSLogin(const Anope::string &uid, NickAlias *na) override { Server *s = Server::Find(uid.substr(0, 3)); - UplinkSocket::Message(Me) << "ENCAP " << (s ? s->GetName() : uid.substr(0, 3)) << " SVSLOGIN " << uid << " * " << (!na->GetVhostIdent().empty() ? na->GetVhostIdent() : '*') - << " " << (!na->GetVhostHost().empty() ? na->GetVhostHost() : '*') << " " << na->nc->display; + + UplinkSocket::Message(Me) << "ENCAP " << (s ? s->GetName() : uid.substr(0, 3)) << " SVSLOGIN " << uid << " * " + << (na && !na->GetVhostIdent().empty() ? na->GetVhostIdent() : '*') + << " " + << (na && !na->GetVhostHost().empty() ? na->GetVhostHost() : '*') + << " " + << (na ? na->nc->display : "0"); } }; diff --git a/modules/protocol/unrealircd.cpp b/modules/protocol/unrealircd.cpp index a6b0aaef8..88826b7da 100644 --- a/modules/protocol/unrealircd.cpp +++ b/modules/protocol/unrealircd.cpp @@ -34,6 +34,7 @@ class UnrealIRCdProto : public IRCDProto CanSQLineChannel = true; CanSZLine = true; CanSVSHold = true; + CanSVSLogout = true; CanCertFP = true; RequiresID = true; MaxModes = 12; @@ -401,11 +402,14 @@ class UnrealIRCdProto : public IRCDProto distmask = uid.substr(0, p); } - if (!na->GetVhostIdent().empty()) - UplinkSocket::Message(Me) << "CHGIDENT " << uid << " " << na->GetVhostIdent(); - if (!na->GetVhostHost().empty()) - UplinkSocket::Message(Me) << "CHGHOST " << uid << " " << na->GetVhostHost(); - UplinkSocket::Message(Me) << "SVSLOGIN " << distmask << " " << uid << " " << na->nc->display; + if (na) + { + if (!na->GetVhostIdent().empty()) + UplinkSocket::Message(Me) << "CHGIDENT " << uid << " " << na->GetVhostIdent(); + if (!na->GetVhostHost().empty()) + UplinkSocket::Message(Me) << "CHGHOST " << uid << " " << na->GetVhostHost(); + } + UplinkSocket::Message(Me) << "SVSLOGIN " << distmask << " " << uid << " " << (na ? na->nc->display : "0"); } bool IsIdentValid(const Anope::string &ident) override |
