summaryrefslogtreecommitdiff
path: root/modules/protocol/ngircd.cpp
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2014-11-30 21:50:11 +0100
committerAlexander Barton <alex@barton.de>2014-11-30 21:50:11 +0100
commitd4732faf4156297a83e27dafdf9e7c30dcf70355 (patch)
tree06aaf57d302b063f9e688442a3d24a99c57d016a /modules/protocol/ngircd.cpp
parent95684187b636c2a02822eb2e9ee26e3b9555d4c4 (diff)
Correctly assign nicks to their respective host servers
Use the "server token" parameter of NICK commands to find the host server and correctly assign the nick name to this server. This allows Anope to correctly free all nick names again when (remote) servers leave the network, which fixes arbitrary "KILL attacks" when such nick names reconnect later on. Initial debugging and patch by DukePyrolator, thanks a lot!
Diffstat (limited to 'modules/protocol/ngircd.cpp')
-rw-r--r--modules/protocol/ngircd.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp
index 1b28ea399..61613423e 100644
--- a/modules/protocol/ngircd.cpp
+++ b/modules/protocol/ngircd.cpp
@@ -448,7 +448,14 @@ struct IRCDMessageNick : IRCDMessage
else if (params.size() == 7)
{
// a new user is connecting to the network
- User::OnIntroduce(params[0], params[2], params[3], "", "", source.GetServer(), params[6], Anope::CurTime, params[5], "", NULL);
+ Server *s = Server::Find(params[4]);
+ if (s == NULL)
+ {
+ Log(LOG_DEBUG) << "User " << params[0] << " introduced from nonexistant server " << params[4] << "?";
+ return;
+ }
+ User::OnIntroduce(params[0], params[2], params[3], "", "", s, params[6], Anope::CurTime, params[5], "", NULL);
+ Log(LOG_DEBUG) << "Registered nick \"" << params[0] << "\" on server " << s->GetName() << ".";
}
else
{