diff options
author | Adam <Adam@anope.org> | 2013-05-08 09:50:43 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-05-08 09:50:43 -0400 |
commit | 9b07e163c0e1ceed30e72aead2338b47ef2da1b2 (patch) | |
tree | 4c13bd545846700a58c5526c3e4e9a6fdf0afc87 /modules/pseudoclients/operserv.cpp | |
parent | 6859decfb8ed0430e946ff81eca4f9da879f69c9 (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/pseudoclients/operserv.cpp')
-rw-r--r-- | modules/pseudoclients/operserv.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp index 0720110cb..a451813ef 100644 --- a/modules/pseudoclients/operserv.cpp +++ b/modules/pseudoclients/operserv.cpp @@ -43,10 +43,7 @@ class SGLineManager : public XLineManager if (x->regex) { Anope::string uh = u->GetIdent() + "@" + u->host, nuhr = u->nick + "!" + uh + "#" + u->realname; - if (x->regex->Matches(uh) || x->regex->Matches(nuhr)) - return true; - - return false; + return x->regex->Matches(uh) || x->regex->Matches(nuhr); } if (!x->GetNick().empty() && !Anope::Match(u->nick, x->GetNick())) @@ -60,14 +57,8 @@ class SGLineManager : public XLineManager if (x->GetHost().find('/') != Anope::string::npos) { - try - { - cidr cidr_ip(x->GetHost()); - sockaddrs ip(u->ip); - if (cidr_ip.match(ip)) - return true; - } - catch (const SocketException &) { } + if (cidr(x->GetHost()).match(sockaddrs(u->ip))) + return true; } if (x->GetHost().empty() || Anope::Match(u->host, x->GetHost()) || Anope::Match(u->ip, x->GetHost())) |