aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_ldapauth.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-04-06 20:06:18 +0100
committerGravatar Sadie Powell2021-04-07 10:36:11 +0100
commit942fd2bcfd384a12c900999fe663202c87319a68 (patch)
treec2bad1906af27afbc3c7d96c3e5ca3c27c83f090 /src/modules/m_ldapauth.cpp
parentMerge branch 'insp3' into master. (diff)
Switch simple iterator loops to use range-based for loops.
Diffstat (limited to 'src/modules/m_ldapauth.cpp')
-rw-r--r--src/modules/m_ldapauth.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/modules/m_ldapauth.cpp b/src/modules/m_ldapauth.cpp
index f6d5e3111..236e0ea11 100644
--- a/src/modules/m_ldapauth.cpp
+++ b/src/modules/m_ldapauth.cpp
@@ -157,12 +157,9 @@ class BindInterface : public LDAPInterface
// check required attributes
checkingAttributes = true;
- for (std::vector<std::pair<std::string, std::string> >::const_iterator it = requiredattributes.begin(); it != requiredattributes.end(); ++it)
+ for (const auto& [attr, val] : requiredattributes)
{
// Note that only one of these has to match for it to be success
- const std::string& attr = it->first;
- const std::string& val = it->second;
-
ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "LDAP compare: %s=%s", attr.c_str(), val.c_str());
try
{
@@ -375,18 +372,18 @@ public:
ModResult OnUserRegister(LocalUser* user) override
{
- for (std::vector<std::string>::const_iterator i = allowpatterns.begin(); i != allowpatterns.end(); ++i)
+ for (const auto& allowpattern : allowpatterns)
{
- if (InspIRCd::Match(user->nick, *i))
+ if (InspIRCd::Match(user->nick, allowpattern))
{
ldapAuthed.Set(user,1);
return MOD_RES_PASSTHRU;
}
}
- for (std::vector<std::string>::iterator i = whitelistedcidrs.begin(); i != whitelistedcidrs.end(); i++)
+ for (const auto& whitelistedcidr : whitelistedcidrs)
{
- if (InspIRCd::MatchCIDR(user->GetIPString(), *i, ascii_case_insensitive_map))
+ if (InspIRCd::MatchCIDR(user->GetIPString(), whitelistedcidr, ascii_case_insensitive_map))
{
ldapAuthed.Set(user,1);
return MOD_RES_PASSTHRU;