From accccc212cd4f08a3c5532b1ae7a17e76bac8718 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Mon, 6 May 2013 11:49:50 +0100 Subject: Replace some C-isms with C++-isms. * 'const char*' to 'const std::string&'. * snprintf to std::string concatenation. * Replace duplicated OneOfMatches with InspIRCd::MatchMask. --- src/modules/extra/m_ldapoper.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_ldapoper.cpp b/src/modules/extra/m_ldapoper.cpp index 856e42dc3..f10773ec9 100644 --- a/src/modules/extra/m_ldapoper.cpp +++ b/src/modules/extra/m_ldapoper.cpp @@ -35,21 +35,6 @@ /* $ModDesc: Adds the ability to authenticate opers via LDAP */ /* $LinkerFlags: -lldap */ -// Duplicated code, also found in cmd_oper and m_sqloper -static bool OneOfMatches(const char* host, const char* ip, const std::string& hostlist) -{ - std::stringstream hl(hostlist); - std::string xhost; - while (hl >> xhost) - { - if (InspIRCd::Match(host, xhost, ascii_case_insensitive_map) || InspIRCd::MatchCIDR(ip, xhost, ascii_case_insensitive_map)) - { - return true; - } - } - return false; -} - struct RAIILDAPString { char *str; @@ -97,7 +82,7 @@ class ModuleLDAPAuth : public Module std::string acceptedhosts = tag->getString("host"); std::string hostname = user->ident + "@" + user->host; - if (!OneOfMatches(hostname.c_str(), user->GetIPString().c_str(), acceptedhosts)) + if (!InspIRCd::MatchMask(acceptedhosts, hostname, user->GetIPString())) return false; if (!LookupOper(opername, inputpass)) -- cgit v1.2.3