From e91c675b094760407d7c00bbec17795f30978c1e Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Tue, 29 Mar 2016 12:38:41 +0200 Subject: Ensure server names passed to some commands are really server names --- src/coremods/core_info/core_info.cpp | 3 ++- src/coremods/core_stats.cpp | 2 +- src/modules/m_check.cpp | 2 +- src/modules/m_opermotd.cpp | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/coremods/core_info/core_info.cpp b/src/coremods/core_info/core_info.cpp index 37fbed273..bd519076d 100644 --- a/src/coremods/core_info/core_info.cpp +++ b/src/coremods/core_info/core_info.cpp @@ -22,7 +22,8 @@ RouteDescriptor ServerTargetCommand::GetRouting(User* user, const std::vector& 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; } diff --git a/src/coremods/core_stats.cpp b/src/coremods/core_stats.cpp index 69f1f3cf8..d890d19ea 100644 --- a/src/coremods/core_stats.cpp +++ b/src/coremods/core_stats.cpp @@ -44,7 +44,7 @@ class CommandStats : public Command CmdResult Handle(const std::vector& parameters, User *user); RouteDescriptor GetRouting(User* user, const std::vector& parameters) { - if (parameters.size() > 1) + if ((parameters.size() > 1) && (parameters[1].find('.') != std::string::npos)) return ROUTE_UNICAST(parameters[1]); return ROUTE_LOCALONLY; } diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index ef9507aa1..17eb9d9c5 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -301,7 +301,7 @@ class CommandCheck : public Command RouteDescriptor GetRouting(User* user, const std::vector& parameters) { - if (parameters.size() > 1) + if ((parameters.size() > 1) && (parameters[1].find('.') != std::string::npos)) return ROUTE_OPT_UCAST(parameters[1]); return ROUTE_LOCALONLY; } diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 010f4ae58..f6cb5853c 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -43,7 +43,7 @@ class CommandOpermotd : public Command RouteDescriptor GetRouting(User* user, const std::vector& parameters) { - if (!parameters.empty()) + if ((!parameters.empty()) && (parameters[0].find('.') != std::string::npos)) return ROUTE_OPT_UCAST(parameters[0]); return ROUTE_LOCALONLY; } -- cgit v1.2.3