]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Ensure server names passed to some commands are really server names
authorAttila Molnar <attilamolnar@hush.com>
Tue, 29 Mar 2016 10:38:41 +0000 (12:38 +0200)
committerAttila Molnar <attilamolnar@hush.com>
Tue, 29 Mar 2016 10:38:41 +0000 (12:38 +0200)
src/coremods/core_info/core_info.cpp
src/coremods/core_stats.cpp
src/modules/m_check.cpp
src/modules/m_opermotd.cpp

index 37fbed2734ef78d330db1ea366dc344d6f3300ed..bd519076d92a23ee0331e549434eb470e3473f03 100644 (file)
@@ -22,7 +22,8 @@
 
 RouteDescriptor ServerTargetCommand::GetRouting(User* user, const std::vector<std::string>& parameters)
 {
-       if (!parameters.empty())
+       // Parameter must be a server name, not a nickname or uuid
+       if ((!parameters.empty()) && (parameters[0].find('.') != std::string::npos))
                return ROUTE_UNICAST(parameters[0]);
        return ROUTE_LOCALONLY;
 }
index 69f1f3cf89e384d16568cf608e1231781cf30911..d890d19ea2f93e1516a611b6d97b92d048ddad81 100644 (file)
@@ -44,7 +44,7 @@ class CommandStats : public Command
        CmdResult Handle(const std::vector<std::string>& parameters, User *user);
        RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
        {
-               if (parameters.size() > 1)
+               if ((parameters.size() > 1) && (parameters[1].find('.') != std::string::npos))
                        return ROUTE_UNICAST(parameters[1]);
                return ROUTE_LOCALONLY;
        }
index ef9507aa1ef82a1e26364bfa71cd2daa9e6c9384..17eb9d9c59d2194840645ceb75aab17dd354f46c 100644 (file)
@@ -301,7 +301,7 @@ class CommandCheck : public Command
 
        RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
        {
-               if (parameters.size() > 1)
+               if ((parameters.size() > 1) && (parameters[1].find('.') != std::string::npos))
                        return ROUTE_OPT_UCAST(parameters[1]);
                return ROUTE_LOCALONLY;
        }
index 010f4ae58a405c2e7df150962ab636e5b85dba90..f6cb5853cff984e1f3d24cd164e3d042009a72c2 100644 (file)
@@ -43,7 +43,7 @@ class CommandOpermotd : public Command
 
        RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
        {
-               if (!parameters.empty())
+               if ((!parameters.empty()) && (parameters[0].find('.') != std::string::npos))
                        return ROUTE_OPT_UCAST(parameters[0]);
                return ROUTE_LOCALONLY;
        }