Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow post-handshake SASL in UnrealIRCd 4.2.2 and up. #235

Merged
merged 3 commits into from Feb 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 27 additions & 6 deletions modules/protocol/unreal4.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down