diff options
author | Adam <adam@sigterm.info> | 2017-04-28 13:16:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-28 13:16:43 -0400 |
commit | 879c1988fea364c9ccdf529599e3bd06615bc3e7 (patch) | |
tree | 0a2d0c904f538086b9d4a4420d038fdfedd175bc | |
parent | 41ef94bebb0fcb358150ff0179c6c55104827683 (diff) | |
parent | fefb6235cd8398408f92f93b9009718b6bed4cd7 (diff) |
Merge pull request #1324 from SaberUK/insp20+cgiirc
[2.0] Fix WEBIRC not rejecting invalid IP addresses.
-rw-r--r-- | src/modules/m_cgiirc.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index cce2e7855..09f6a4659 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -73,6 +73,7 @@ class CommandWebirc : public Command realhost("cgiirc_realhost", Creator), realip("cgiirc_realip", Creator), webirc_hostname("cgiirc_webirc_hostname", Creator), webirc_ip("cgiirc_webirc_ip", Creator) { + allow_empty_last_param = false; works_before_reg = true; this->syntax = "password client hostname ip"; } @@ -81,6 +82,14 @@ class CommandWebirc : public Command if(user->registered == REG_ALL) return CMD_FAILURE; + irc::sockets::sockaddrs ipaddr; + if (!irc::sockets::aptosa(parameters[3], 0, ipaddr)) + { + IS_LOCAL(user)->CommandFloodPenalty += 5000; + ServerInstance->SNO->WriteGlobalSno('a', "Connecting user %s tried to use WEBIRC but gave an invalid IP address.", user->GetFullRealHost().c_str()); + return CMD_FAILURE; + } + for(CGIHostlist::iterator iter = Hosts.begin(); iter != Hosts.end(); iter++) { if(InspIRCd::Match(user->host, iter->hostmask, ascii_case_insensitive_map) || InspIRCd::MatchCIDR(user->GetIPString(), iter->hostmask, ascii_case_insensitive_map)) @@ -108,6 +117,7 @@ class CommandWebirc : public Command } } + IS_LOCAL(user)->CommandFloodPenalty += 5000; ServerInstance->SNO->WriteGlobalSno('a', "Connecting user %s tried to use WEBIRC, but didn't match any configured webirc blocks.", user->GetFullRealHost().c_str()); return CMD_FAILURE; } |