From 942fd2bcfd384a12c900999fe663202c87319a68 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 6 Apr 2021 20:06:18 +0100 Subject: Switch simple iterator loops to use range-based for loops. --- src/modules/m_ldapauth.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/modules/m_ldapauth.cpp') 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 >::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::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::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; -- cgit v1.3.1-10-gc9f91