diff options
author | Peter Powell <petpow@saberuk.com> | 2018-11-21 12:59:02 +0000 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2018-11-21 14:01:52 +0000 |
commit | a77954b2181e5f20e951a0a09579dfcfe3905641 (patch) | |
tree | c70cd2c00069a9323957cee453a1d1c03a1d544c /src/modules/m_cgiirc.cpp | |
parent | 705853459e7170316fde62f25e40398b35bd4870 (diff) |
Only try to parse the WebIRC IP if the user matches a host.
Diffstat (limited to 'src/modules/m_cgiirc.cpp')
-rw-r--r-- | src/modules/m_cgiirc.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
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<WebIRCHost>::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()); |