summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-01-10 17:53:48 -0500
committerAdam <Adam@anope.org>2012-01-10 17:53:48 -0500
commit7c03e60299c98106cff3b02c06bd7c5b7b0830f3 (patch)
tree345483748a72e493580a90c7ee24bac1ca640a0e
parent1e9d88af011fd14efe7db95a59d12cd634b492f5 (diff)
Removed this "valid" ip check in cidr::cidr, is wrong for IPv6 and ::pton checks this anyway using inet_pton. Also fixed a comment Robby broke in chanserv.conf
-rw-r--r--data/chanserv.example.conf2
-rw-r--r--src/sockets.cpp12
2 files changed, 6 insertions, 8 deletions
diff --git a/data/chanserv.example.conf b/data/chanserv.example.conf
index 41cd18562..f3310b745 100644
--- a/data/chanserv.example.conf
+++ b/data/chanserv.example.conf
@@ -855,7 +855,7 @@ command { service = "ChanServ"; name = "KB"; command = "chanserv/ban"; }
*
* Provides the command chanserv/tban.
*
- * Used for banning users from channels for a specified time (in seconds).
+ * Used for banning users from channels for a specified time.
*/
module { name = "cs_tban" }
command { service = "ChanServ"; name = "TBAN"; command = "chanserv/tban"; }
diff --git a/src/sockets.cpp b/src/sockets.cpp
index 5e65a521c..9b985a504 100644
--- a/src/sockets.cpp
+++ b/src/sockets.cpp
@@ -122,9 +122,9 @@ void sockaddrs::pton(int type, const Anope::string &address, int pport)
{
int i = inet_pton(type, address.c_str(), &sa4.sin_addr);
if (i == 0)
- throw SocketException("Invalid host");
+ throw SocketException("Invalid IP");
else if (i <= -1)
- throw SocketException("Invalid host: " + Anope::LastError());
+ throw SocketException("Invalid IP: " + Anope::LastError());
sa4.sin_family = type;
sa4.sin_port = htons(pport);
return;
@@ -133,9 +133,9 @@ void sockaddrs::pton(int type, const Anope::string &address, int pport)
{
int i = inet_pton(type, address.c_str(), &sa6.sin6_addr);
if (i == 0)
- throw SocketException("Invalid host");
+ throw SocketException("Invalid IP");
else if (i <= -1)
- throw SocketException("Invalid host: " + Anope::LastError());
+ throw SocketException("Invalid IP: " + Anope::LastError());
sa6.sin6_family = type;
sa6.sin6_port = htons(pport);
return;
@@ -173,11 +173,9 @@ void sockaddrs::ntop(int type, const void *src)
cidr::cidr(const Anope::string &ip)
{
- if (ip.find_first_not_of("01234567890:./") != Anope::string::npos)
- throw SocketException("Invalid IP");
-
bool ipv6 = ip.find(':') != Anope::string::npos;
size_t sl = ip.find_last_of('/');
+
if (sl == Anope::string::npos)
{
this->cidr_ip = ip;