From a77954b2181e5f20e951a0a09579dfcfe3905641 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 21 Nov 2018 12:59:02 +0000 Subject: Only try to parse the WebIRC IP if the user matches a host. --- src/modules/m_cgiirc.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index de9cec8cd..4d0edcb23 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -161,21 +161,21 @@ class CommandWebIRC : public SplitCommand if (user->registered == REG_ALL || realhost.get(user)) return CMD_FAILURE; - irc::sockets::sockaddrs ipaddr; - if (!irc::sockets::aptosa(parameters[3], user->client_sa.port(), ipaddr)) - { - user->CommandFloodPenalty += 5000; - WriteLog("Connecting user %s (%s) tried to use WEBIRC but gave an invalid IP address.", - user->uuid.c_str(), user->GetIPString().c_str()); - return CMD_FAILURE; - } - for (std::vector::const_iterator iter = hosts.begin(); iter != hosts.end(); ++iter) { // If we don't match the host then skip to the next host. if (!iter->Matches(user, parameters[0])) continue; + irc::sockets::sockaddrs ipaddr; + if (!irc::sockets::aptosa(parameters[3], user->client_sa.port(), ipaddr)) + { + user->CommandFloodPenalty += 5000; + WriteLog("Connecting user %s (%s) tried to use WEBIRC but gave an invalid IP address.", + user->uuid.c_str(), user->GetIPString().c_str()); + return CMD_FAILURE; + } + // The user matched a WebIRC block! gateway.set(user, parameters[1]); realhost.set(user, user->GetRealHost()); -- cgit v1.2.3