diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-04-04 18:30:02 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-04-04 18:30:02 +0200 |
commit | 23183603b7ea3b2a50ce082d573bef07ab794686 (patch) | |
tree | e6076a2aeeac67c6dca294f83b30f9d326d24d70 /src | |
parent | 957676efd8e1330f1e1314046376f3d9dd1eab18 (diff) |
Add REG_ALL checks to treat unregistered users as nonexistent in more cases
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/cmd_ison.cpp | 4 | ||||
-rw-r--r-- | src/commands/cmd_kick.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_samode.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_saquit.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/idle.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_watch.cpp | 2 |
6 files changed, 17 insertions, 7 deletions
diff --git a/src/commands/cmd_ison.cpp b/src/commands/cmd_ison.cpp index 227f1b3ed..01d12e13b 100644 --- a/src/commands/cmd_ison.cpp +++ b/src/commands/cmd_ison.cpp @@ -56,7 +56,7 @@ CmdResult CommandIson::Handle (const std::vector<std::string>& parameters, User if (ison_already.find(u) != ison_already.end()) continue; - if (u) + if ((u) && (u->registered == REG_ALL)) { reply.append(u->nick).append(" "); if (reply.length() > 450) @@ -81,7 +81,7 @@ CmdResult CommandIson::Handle (const std::vector<std::string>& parameters, User if (ison_already.find(u) != ison_already.end()) continue; - if (u) + if ((u) && (u->registered == REG_ALL)) { reply.append(u->nick).append(" "); if (reply.length() > 450) diff --git a/src/commands/cmd_kick.cpp b/src/commands/cmd_kick.cpp index 3c5fb0052..c497dd459 100644 --- a/src/commands/cmd_kick.cpp +++ b/src/commands/cmd_kick.cpp @@ -56,9 +56,9 @@ CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User else u = ServerInstance->FindNick(parameters[1]); - if (!u || !c) + if ((!u) || (!c) || (u->registered != REG_ALL)) { - user->WriteServ( "401 %s %s :No such nick/channel", user->nick.c_str(), u ? parameters[0].c_str() : parameters[1].c_str()); + user->WriteServ( "401 %s %s :No such nick/channel", user->nick.c_str(), c ? parameters[1].c_str() : parameters[0].c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 9b71992a6..ea2ae24ab 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -39,6 +39,16 @@ class CommandSamode : public Command CmdResult Handle (const std::vector<std::string>& parameters, User *user) { + if (parameters[0].c_str()[0] != '#') + { + User* target = ServerInstance->FindNickOnly(parameters[0]); + if ((!target) || (target->registered != REG_ALL)) + { + user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); + return CMD_FAILURE; + } + } + this->active = true; ServerInstance->Parser->CallHandler("MODE", parameters, user); if (ServerInstance->Modes->GetLastParse().length()) diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 3b7bdc824..909a026ab 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -37,7 +37,7 @@ class CommandSaquit : public Command CmdResult Handle (const std::vector<std::string>& parameters, User *user) { User* dest = ServerInstance->FindNick(parameters[0]); - if ((dest) && (!IS_SERVER(dest))) + if ((dest) && (!IS_SERVER(dest)) && (dest->registered == REG_ALL)) { if (ServerInstance->ULine(dest->server)) { diff --git a/src/modules/m_spanningtree/idle.cpp b/src/modules/m_spanningtree/idle.cpp index 8bc0cd2bb..0ea06a3cc 100644 --- a/src/modules/m_spanningtree/idle.cpp +++ b/src/modules/m_spanningtree/idle.cpp @@ -59,7 +59,7 @@ bool TreeSocket::Whois(const std::string &prefix, parameterlist ¶ms) { std::string who_did_the_whois = params[0]; User* who_to_send_to = ServerInstance->FindNick(who_did_the_whois); - if ((who_to_send_to) && (IS_LOCAL(who_to_send_to))) + if ((who_to_send_to) && (IS_LOCAL(who_to_send_to)) && (who_to_send_to->registered == REG_ALL)) { // an incoming reply to a whois we sent out std::string nick_whoised = prefix; diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index fa7e212bb..0e532d65b 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -238,7 +238,7 @@ class CommandWatch : public Command } User* target = ServerInstance->FindNick(nick); - if (target) + if ((target) && (target->registered == REG_ALL)) { (*wl)[nick] = std::string(target->ident).append(" ").append(target->dhost).append(" ").append(ConvToStr(target->age)); user->WriteNumeric(604, "%s %s %s :is online",user->nick.c_str(), nick, (*wl)[nick].c_str()); |