From 9b07e163c0e1ceed30e72aead2338b47ef2da1b2 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 8 May 2013 09:50:43 -0400 Subject: Make sockaddrs/cidr not throw on invalid ips to give us an easier/cheaper way to test for a valid IP --- modules/pseudoclients/operserv.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'modules/pseudoclients') 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())) -- cgit