summaryrefslogtreecommitdiff
path: root/modules/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'modules/protocol')
-rw-r--r--modules/protocol/bahamut.cpp18
-rw-r--r--modules/protocol/inspircd11.cpp18
-rw-r--r--modules/protocol/inspircd12.cpp9
-rw-r--r--modules/protocol/unreal.cpp28
4 files changed, 38 insertions, 35 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index 6aa097433..f485bd62c 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -143,14 +143,15 @@ class BahamutIRCdProto : public IRCDProto
return;
/* ZLine if we can instead */
- if (x->GetUser() == "*" && x->GetHost().find_first_not_of("0123456789:.") == Anope::string::npos)
- try
+ if (x->GetUser() == "*")
+ {
+ sockaddrs a(x->GetHost());
+ if (a.valid())
{
- sockaddrs(x->GetHost());
IRCD->SendSZLineDel(x);
return;
}
- catch (const SocketException &) { }
+ }
UplinkSocket::Message() << "RAKILL " << x->GetHost() << " " << x->GetUser();
}
@@ -214,14 +215,15 @@ class BahamutIRCdProto : public IRCDProto
}
/* ZLine if we can instead */
- if (x->GetUser() == "*" && x->GetHost().find_first_not_of("0123456789:.") == Anope::string::npos)
- try
+ if (x->GetUser() == "*")
+ {
+ sockaddrs a(x->GetHost());
+ if (a.valid())
{
- sockaddrs(x->GetHost());
IRCD->SendSZLine(u, x);
return;
}
- catch (const SocketException &) { }
+ }
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->expires - Anope::CurTime;
diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp
index 12a22e724..f978417f6 100644
--- a/modules/protocol/inspircd11.cpp
+++ b/modules/protocol/inspircd11.cpp
@@ -80,14 +80,15 @@ class InspIRCdProto : public IRCDProto
return;
/* ZLine if we can instead */
- if (x->GetUser() == "*" && x->GetHost().find_first_not_of("0123456789:.") == Anope::string::npos)
- try
+ if (x->GetUser() == "*")
+ {
+ sockaddrs a(x->GetHost());
+ if (a.valid())
{
- sockaddrs(x->GetHost());
IRCD->SendSZLineDel(x);
return;
}
- catch (const SocketException &) { }
+ }
UplinkSocket::Message(OperServ) << "GLINE " << x->mask;
}
@@ -134,14 +135,15 @@ class InspIRCdProto : public IRCDProto
}
/* ZLine if we can instead */
- if (x->GetUser() == "*" && x->GetHost().find_first_not_of("0123456789:.") == Anope::string::npos)
- try
+ if (x->GetUser() == "*")
+ {
+ sockaddrs a(x->GetHost());
+ if (a.valid())
{
- sockaddrs(x->GetHost());
IRCD->SendSZLine(u, x);
return;
}
- catch (const SocketException &) { }
+ }
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->expires - Anope::CurTime;
diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp
index c3fa04b85..d46d8733e 100644
--- a/modules/protocol/inspircd12.cpp
+++ b/modules/protocol/inspircd12.cpp
@@ -180,14 +180,15 @@ class InspIRCd12Proto : public IRCDProto
}
/* ZLine if we can instead */
- if (x->GetUser() == "*" && x->GetHost().find_first_not_of("0123456789:.") == Anope::string::npos)
- try
+ if (x->GetUser() == "*")
+ {
+ sockaddrs addr(x->GetHost());
+ if (addr.valid())
{
- sockaddrs(x->GetHost());
IRCD->SendSZLine(u, x);
return;
}
- catch (const SocketException &) { }
+ }
SendAddLine("G", x->GetUser() + "@" + x->GetHost(), timeleft, x->by, x->GetReason());
}
diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp
index 4186ee5d0..ea5da3dbe 100644
--- a/modules/protocol/unreal.cpp
+++ b/modules/protocol/unreal.cpp
@@ -46,14 +46,15 @@ class UnrealIRCdProto : public IRCDProto
return;
/* ZLine if we can instead */
- if (x->GetUser() == "*" && x->GetHost().find_first_not_of("0123456789:.") == Anope::string::npos)
- try
+ if (x->GetUser() == "*")
+ {
+ sockaddrs a(x->GetHost());
+ if (a.valid())
{
- sockaddrs(x->GetHost());
IRCD->SendSZLineDel(x);
return;
}
- catch (const SocketException &) { }
+ }
UplinkSocket::Message() << "TKL - G " << x->GetUser() << " " << x->GetHost() << " " << x->by;
}
@@ -108,14 +109,15 @@ class UnrealIRCdProto : public IRCDProto
}
/* ZLine if we can instead */
- if (x->GetUser() == "*" && x->GetHost().find_first_not_of("0123456789:.") == Anope::string::npos)
- try
+ if (x->GetUser() == "*")
+ {
+ sockaddrs a(x->GetHost());
+ if (a.valid())
{
- sockaddrs(x->GetHost());
IRCD->SendSZLine(u, x);
return;
}
- catch (const SocketException &) { }
+ }
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->expires - Anope::CurTime;
@@ -786,13 +788,9 @@ struct IRCDMessageNick : IRCDMessage
Anope::string decoded_ip;
Anope::B64Decode(params[9], decoded_ip);
- try
- {
- sockaddrs ip_addr;
- ip_addr.ntop(params[9].length() == 8 ? AF_INET : AF_INET6, decoded_ip.c_str());
- ip = ip_addr.addr();
- }
- catch (const SocketException &ex) { }
+ sockaddrs ip_addr;
+ ip_addr.ntop(params[9].length() == 8 ? AF_INET : AF_INET6, decoded_ip.c_str());
+ ip = ip_addr.addr();
}
Anope::string vhost = params[8];