From d4732faf4156297a83e27dafdf9e7c30dcf70355 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sun, 30 Nov 2014 21:50:11 +0100 Subject: [PATCH] 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! --- modules/protocol/ngircd.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 {