summaryrefslogtreecommitdiff
path: root/modules/extra
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-05-08 09:50:43 -0400
committerAdam <Adam@anope.org>2013-05-08 09:50:43 -0400
commit9b07e163c0e1ceed30e72aead2338b47ef2da1b2 (patch)
tree4c13bd545846700a58c5526c3e4e9a6fdf0afc87 /modules/extra
parent6859decfb8ed0430e946ff81eca4f9da879f69c9 (diff)
Make sockaddrs/cidr not throw on invalid ips to give us an easier/cheaper way to test for a valid IP
Diffstat (limited to 'modules/extra')
-rw-r--r--modules/extra/m_proxyscan.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/modules/extra/m_proxyscan.cpp b/modules/extra/m_proxyscan.cpp
index da2ab5692..4e2a6bd88 100644
--- a/modules/extra/m_proxyscan.cpp
+++ b/modules/extra/m_proxyscan.cpp
@@ -149,14 +149,9 @@ class SOCKS5ProxyConnect : public ProxyConnect, public BinarySocket
sockaddrs target_addr;
char buf[4 + sizeof(target_addr.sa4.sin_addr.s_addr) + sizeof(target_addr.sa4.sin_port)];
int ptr = 0;
- try
- {
- target_addr.pton(AF_INET, target_ip, target_port);
- }
- catch (const SocketException &)
- {
+ target_addr.pton(AF_INET, target_ip, target_port);
+ if (!target_addr.valid())
return;
- }
buf[ptr++] = 5; // Version
buf[ptr++] = 1; // # of methods
@@ -340,15 +335,10 @@ class ModuleProxyScan : public Module
/* At this time we only support IPv4 */
sockaddrs user_ip;
- try
- {
- user_ip.pton(AF_INET, user->ip);
- }
- catch (const SocketException &)
- {
+ user_ip.pton(AF_INET, user->ip);
+ if (!user_ip.valid())
/* User doesn't have a valid IPv4 IP (ipv6/spoof/etc) */
return;
- }
if (!this->con_notice.empty() && !this->con_source.empty())
{