diff options
author | attilamolnar <attilamolnar@hush.com> | 2012-11-19 03:37:59 +0100 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2012-12-15 19:47:40 +0100 |
commit | e3e3a35899931d98e76023464f9b077b09ba828d (patch) | |
tree | 5a4dbe8907a2bd25e1ac5a72ca5a182efdae7041 /src/modules | |
parent | 71d53e4883cdb83b50f43cd934ac9b4cd2b95383 (diff) |
Add IS_SERVER() and REG_ALL checks to (mostly oper only) commands taking a target nickname
If a SID was passed as the target user parameter or when it's an unregistered user reply with the "no such nick" (or the moral equivalent) message
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_chghost.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_chgident.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_chgname.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_nicklock.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_remove.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_sajoin.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_sakick.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_sanick.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_sapart.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_saquit.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_sasl.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_shun.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/away.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/metadata.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/operquit.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/save.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_sslinfo.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_swhois.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_uninvite.cpp | 2 |
19 files changed, 21 insertions, 21 deletions
diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 4d39127e7..ac318f9af 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -58,7 +58,7 @@ class CommandChghost : public Command User* dest = ServerInstance->FindNick(parameters[0]); - if (!dest) + if ((!dest) || (dest->registered != REG_ALL)) { user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 968497f8c..7dfd71c97 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -40,7 +40,7 @@ class CommandChgident : public Command { User* dest = ServerInstance->FindNick(parameters[0]); - if (!dest) + if ((!dest) || (dest->registered != REG_ALL)) { user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index aadf29fdb..3ce1da5ec 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -38,7 +38,7 @@ class CommandChgname : public Command { User* dest = ServerInstance->FindNick(parameters[0]); - if (!dest) + if ((!dest) || (dest->registered != REG_ALL)) { user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index a67c1b433..abeb25869 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -42,7 +42,7 @@ class CommandNicklock : public Command { User* target = ServerInstance->FindNick(parameters[0]); - if (!target) + if ((!target) || (target->registered != REG_ALL)) { user->WriteServ("NOTICE %s :*** No such nickname: '%s'", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index ffb8f8e55..86f50ad62 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -69,9 +69,9 @@ class RemoveBase : public Command channel = ServerInstance->FindChan(channame); /* Fix by brain - someone needs to learn to validate their input! */ - if (!target || !channel) + if ((!target) || (target->registered != REG_ALL) || (!channel)) { - user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), !target ? username.c_str() : channame.c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), !channel ? channame.c_str() : username.c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index d3c939b04..63d51f86d 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -37,7 +37,7 @@ class CommandSajoin : public Command CmdResult Handle (const std::vector<std::string>& parameters, User *user) { User* dest = ServerInstance->FindNick(parameters[0]); - if (dest) + if ((dest) && (dest->registered == REG_ALL)) { if (ServerInstance->ULine(dest->server)) { diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp index efd991ff0..7dfcd8904 100644 --- a/src/modules/m_sakick.cpp +++ b/src/modules/m_sakick.cpp @@ -39,7 +39,7 @@ class CommandSakick : public Command Channel* channel = ServerInstance->FindChan(parameters[0]); const char* reason = ""; - if (dest && channel) + if ((dest) && (dest->registered == REG_ALL) && (channel)) { if (parameters.size() > 2) { diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 722c9596d..cf093d28a 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -47,7 +47,7 @@ class CommandSanick : public Command return CMD_FAILURE; } - if (!target) + if ((!target) || (target->registered != REG_ALL)) { user->WriteServ("NOTICE %s :*** No such nickname: '%s'", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index 6bd961ea7..89256e0e4 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -40,7 +40,7 @@ class CommandSapart : public Command Channel* channel = ServerInstance->FindChan(parameters[1]); std::string reason; - if (dest && channel) + if ((dest) && (dest->registered == REG_ALL) && (channel)) { if (parameters.size() > 2) reason = parameters[2]; diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 6afae913d..3b7bdc824 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) + if ((dest) && (!IS_SERVER(dest))) { if (ServerInstance->ULine(dest->server)) { diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 943f45bd3..59751588e 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -208,7 +208,7 @@ class CommandSASL : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user) { User* target = ServerInstance->FindNick(parameters[1]); - if (!target) + if ((!target) || (IS_SERVER(target))) { ServerInstance->Logs->Log("m_sasl", DEBUG,"User not found in sasl ENCAP event: %s", parameters[1].c_str()); return CMD_FAILURE; diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 39e23f22e..21959e400 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -108,8 +108,8 @@ class CommandShun : public Command std::string target = parameters[0]; - User *find = ServerInstance->FindNick(target.c_str()); - if (find) + User *find = ServerInstance->FindNick(target); + if ((find) && (find->registered == REG_ALL)) target = std::string("*!*@") + find->GetIPString(); if (parameters.size() == 1) diff --git a/src/modules/m_spanningtree/away.cpp b/src/modules/m_spanningtree/away.cpp index 3b6d44f0f..ed97c48cd 100644 --- a/src/modules/m_spanningtree/away.cpp +++ b/src/modules/m_spanningtree/away.cpp @@ -27,7 +27,7 @@ bool TreeSocket::Away(const std::string &prefix, parameterlist ¶ms) { User* u = ServerInstance->FindNick(prefix); - if (!u) + if ((!u) || (IS_SERVER(u))) return true; if (params.size()) { diff --git a/src/modules/m_spanningtree/metadata.cpp b/src/modules/m_spanningtree/metadata.cpp index f74b2dc62..a584f8fa8 100644 --- a/src/modules/m_spanningtree/metadata.cpp +++ b/src/modules/m_spanningtree/metadata.cpp @@ -46,7 +46,7 @@ CmdResult CommandMetadata::Handle(const std::vector<std::string>& params, User * else if (*(params[0].c_str()) != '#') { User* u = ServerInstance->FindUUID(params[0]); - if (u) + if ((u) && (!IS_SERVER(u))) { if (item) item->unserialize(FORMAT_NETWORK, u, value); diff --git a/src/modules/m_spanningtree/operquit.cpp b/src/modules/m_spanningtree/operquit.cpp index d06541706..af2e04ebc 100644 --- a/src/modules/m_spanningtree/operquit.cpp +++ b/src/modules/m_spanningtree/operquit.cpp @@ -34,7 +34,7 @@ bool TreeSocket::OperQuit(const std::string &prefix, parameterlist ¶ms) User* u = ServerInstance->FindUUID(prefix); - if (u) + if ((u) && (!IS_SERVER(u))) { ServerInstance->OperQuit.set(u, params[0]); params[0] = ":" + params[0]; diff --git a/src/modules/m_spanningtree/save.cpp b/src/modules/m_spanningtree/save.cpp index de9cb7316..92999b422 100644 --- a/src/modules/m_spanningtree/save.cpp +++ b/src/modules/m_spanningtree/save.cpp @@ -40,7 +40,7 @@ bool TreeSocket::ForceNick(const std::string &prefix, parameterlist ¶ms) User* u = ServerInstance->FindNick(params[0]); time_t ts = atol(params[1].c_str()); - if (u && u->age == ts) + if ((u) && (!IS_SERVER(u)) && (u->age == ts)) { Utils->DoOneToAllButSender(prefix,"SAVE",params,prefix); diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 161e7055c..2bfe0e1c4 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -91,7 +91,7 @@ class CommandSSLInfo : public Command { User* target = ServerInstance->FindNickOnly(parameters[0]); - if (!target) + if ((!target) || (target->registered != REG_ALL)) { user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nickname", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 2e5abe95a..742781747 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -43,7 +43,7 @@ class CommandSwhois : public Command { User* dest = ServerInstance->FindNick(parameters[0]); - if (!dest) + if ((!dest) || (IS_SERVER(dest))) // allow setting swhois using SWHOIS before reg { user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index 618e23892..10fd7c7b6 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -40,7 +40,7 @@ class CommandUninvite : public Command User* u = ServerInstance->FindNick(parameters[0]); Channel* c = ServerInstance->FindChan(parameters[1]); - if ((!c) || (!u)) + if ((!c) || (!u) || (u->registered != REG_ALL)) { if (!c) { |