]> granicus.if.org Git - pdns/commitdiff
Fix iterator usage
authorAki Tuomi <cmouse@desteem.org>
Tue, 29 Sep 2015 19:13:24 +0000 (22:13 +0300)
committerAki Tuomi <cmouse@desteem.org>
Sat, 3 Oct 2015 22:01:12 +0000 (01:01 +0300)
Closes several cids

modules/ldapbackend/ldapbackend.cc

index f9a4e406cca38d3866204c75b7c4705aefbdb78d..6d00e84bfe86d89d8f90881653ab0acb9100bde4 100644 (file)
@@ -269,7 +269,6 @@ void LdapBackend::lookup_tree( const QType &qtype, const DNSName &qname, DNSPack
         string filter, attr, qesc, dn;
         const char** attributes = ldap_attrany + 1;   // skip associatedDomain
         const char* attronly[] = { NULL, "dNSTTL", "modifyTimestamp", NULL };
-        vector<string>::reverse_iterator i;
         vector<string> parts;
 
 
@@ -287,7 +286,7 @@ void LdapBackend::lookup_tree( const QType &qtype, const DNSName &qname, DNSPack
         filter = strbind( ":target:", filter, getArg( "filter-lookup" ) );
 
         stringtok( parts, toLower( qname.toString() ), "." );
-        for( i = parts.rbegin(); i != parts.rend(); i++ )
+        for(auto i = parts.crbegin(); i != parts.crend(); i++ )
         {
                dn = "dc=" + *i + "," + dn;
         }
@@ -349,8 +348,7 @@ inline bool LdapBackend::prepare_simple()
         {
                if( m_result.count( "associatedDomain" ) )
                {
-                       vector<string>::iterator i;
-                       for( i = m_result["associatedDomain"].begin(); i != m_result["associatedDomain"].end(); i++ ) {
+                       for(auto i = m_result["associatedDomain"].begin(); i != m_result["associatedDomain"].end(); i++ ) {
                                if( i->size() >= m_axfrqlen && i->substr( i->size() - m_axfrqlen, m_axfrqlen ) == m_qname.toString() /* ugh */ ) {
                                  m_adomains.push_back( DNSName(*i) );
                                }
@@ -379,8 +377,7 @@ inline bool LdapBackend::prepare_strict()
         {
                if( m_result.count( "associatedDomain" ) )
                {
-                       vector<string>::iterator i;
-                       for( i = m_result["associatedDomain"].begin(); i != m_result["associatedDomain"].end(); i++ ) {
+                       for(auto i = m_result["associatedDomain"].begin(); i != m_result["associatedDomain"].end(); i++ ) {
                                if( i->size() >= m_axfrqlen && i->substr( i->size() - m_axfrqlen, m_axfrqlen ) == m_qname.toString() /* ugh */ ) {
                                  m_adomains.push_back( DNSName(*i) );
                                }