diff options
author | Peter Powell <petpow@saberuk.com> | 2013-05-06 11:49:50 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2013-05-15 03:32:56 +0100 |
commit | accccc212cd4f08a3c5532b1ae7a17e76bac8718 (patch) | |
tree | 18f4370778cc79d2f21a4308dafbb29a77cfa213 /src/modules/extra | |
parent | 23e8bba13c55d33ce89d505780da36c9589e300a (diff) |
Replace some C-isms with C++-isms.
* 'const char*' to 'const std::string&'.
* snprintf to std::string concatenation.
* Replace duplicated OneOfMatches with InspIRCd::MatchMask.
Diffstat (limited to 'src/modules/extra')
-rw-r--r-- | src/modules/extra/m_ldapoper.cpp | 17 |
1 files changed, 1 insertions, 16 deletions
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)) |