summaryrefslogtreecommitdiff
path: root/modules/protocol/unreal4.cpp
diff options
context:
space:
mode:
authorBram Matthys <syzop@vulnscan.org>2019-02-09 23:10:23 +0100
committerAdam <adam@sigterm.info>2019-02-09 17:10:23 -0500
commitda6e2730c259d6d6356a0a948e85730ae34663ab (patch)
tree1a9e61fa2d87cd174abae68a8e2b21105402e46a /modules/protocol/unreal4.cpp
parent2b8072bf80f7cef3e06600034938f83d26a965fb (diff)
Allow post-handshake SASL in UnrealIRCd 4.2.2 and up.
This updates the unreal4 protocol module to work with both pseudo-id's and real UID's. Something that will also be necessary once UnrealIRCd gets rid of pseudo-id's altogether.
Diffstat (limited to 'modules/protocol/unreal4.cpp')
-rw-r--r--modules/protocol/unreal4.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/modules/protocol/unreal4.cpp b/modules/protocol/unreal4.cpp
index 3bffcd6b2..f48981739 100644
--- a/modules/protocol/unreal4.cpp
+++ b/modules/protocol/unreal4.cpp
@@ -373,18 +373,40 @@ class UnrealIRCdProto : public IRCDProto
void SendSASLMessage(const SASL::Message &message) anope_override
{
size_t p = message.target.find('!');
+ Anope::string distmask;
+
if (p == Anope::string::npos)
- return;
+ {
+ Server *s = Server::Find(message.target.substr(0, 3));
+ if (!s)
+ return;
+ distmask = s->GetName();
+ }
+ else
+ {
+ distmask = message.target.substr(0, p);
+ }
- UplinkSocket::Message(BotInfo::Find(message.source)) << "SASL " << message.target.substr(0, p) << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : " " + message.ext);
+ UplinkSocket::Message(BotInfo::Find(message.source)) << "SASL " << distmask << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : " " + message.ext);
}
void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) anope_override
{
size_t p = uid.find('!');
+ Anope::string distmask;
+
if (p == Anope::string::npos)
- return;
- UplinkSocket::Message(Me) << "SVSLOGIN " << uid.substr(0, p) << " " << uid << " " << acc;
+ {
+ Server *s = Server::Find(uid.substr(0, 3));
+ if (!s)
+ return;
+ distmask = s->GetName();
+ }
+ else
+ {
+ distmask = uid.substr(0, p);
+ }
+ UplinkSocket::Message(Me) << "SVSLOGIN " << distmask << " " << uid << " " << acc;
}
bool IsIdentValid(const Anope::string &ident) anope_override
@@ -1005,8 +1027,7 @@ struct IRCDMessageSASL : IRCDMessage
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
{
- size_t p = params[1].find('!');
- if (!SASL::sasl || p == Anope::string::npos)
+ if (!SASL::sasl)
return;
SASL::Message m;