]> granicus.if.org Git - pdns/commitdiff
opendbx and ldabbackend fixes for DNSName
authorbert hubert <bert.hubert@powerdns.com>
Mon, 28 Sep 2015 07:36:12 +0000 (09:36 +0200)
committerbert hubert <bert.hubert@powerdns.com>
Mon, 28 Sep 2015 07:36:12 +0000 (09:36 +0200)
modules/ldapbackend/ldapbackend.cc
modules/opendbxbackend/odbxbackend.cc
modules/opendbxbackend/odbxprivate.cc

index 9945df68366ab409a330cdcc82a5a51b3f1b09c9..f9a4e406cca38d3866204c75b7c4705aefbdb78d 100644 (file)
@@ -3,12 +3,8 @@
 #endif
 #include "ldapbackend.hh"
 
-
-
 unsigned int ldap_host_index = 0;
 
-
-
 LdapBackend::LdapBackend( const string &suffix )
 {
         string hoststr;
@@ -19,7 +15,7 @@ LdapBackend::LdapBackend( const string &suffix )
         try
         {
                m_msgid = 0;
-               m_qname = "";
+               m_qname.clear();
                m_pldap = NULL;
                m_qlog = arg().mustDo( "query-logging" );
                m_default_ttl = arg().asNum( "default-ttl" );
@@ -101,12 +97,12 @@ bool LdapBackend::list( const DNSName& target, int domain_id, bool include_disab
         }
         catch( LDAPTimeout &lt )
         {
-               L << Logger::Warning << m_myname << " Unable to get zone " + target + " from LDAP directory: " << lt.what() << endl;
+               L << Logger::Warning << m_myname << " Unable to get zone " << target << " from LDAP directory: " << lt.what() << endl;
                throw( DBException( "LDAP server timeout" ) );
         }
         catch( LDAPException &le )
         {
-               L << Logger::Error << m_myname << " Unable to get zone " + target + " from LDAP directory: " << le.what() << endl;
+               L << Logger::Error << m_myname << " Unable to get zone " << target << " from LDAP directory: " << le.what() << endl;
                throw( PDNSException( "LDAP server unreachable" ) );   // try to reconnect to another server
         }
         catch( std::exception &e )
@@ -356,7 +352,7 @@ inline bool LdapBackend::prepare_simple()
                        vector<string>::iterator i;
                        for( 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( *i );
+                                 m_adomains.push_back( DNSName(*i) );
                                }
                        }
                        m_result.erase( "associatedDomain" );
@@ -386,7 +382,7 @@ inline bool LdapBackend::prepare_strict()
                        vector<string>::iterator i;
                        for( 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( *i );
+                                 m_adomains.push_back( DNSName(*i) );
                                }
                        }
                        m_result.erase( "associatedDomain" );
@@ -482,7 +478,7 @@ bool LdapBackend::get( DNSResourceRecord &rr )
 
                di.id = 0;
                di.serial = sd.serial;
-               di.zone = domain;
+               di.zone = DNSName(domain);
                di.last_check = 0;
                di.backend = this;
                di.kind = DomainInfo::Master;
index 63d3d4dc6e983f9a495ae854438be602e8635b4a..a3ffaa7b7d3fcfcc74eb82048775f4624349eafa 100644 (file)
@@ -101,7 +101,7 @@ bool OdbxBackend::getDomainInfo( const string& domain, DomainInfo& di )
                do
                {
                        di.id = 0;
-                       di.zone = "";
+                       di.zone.clear();
                        di.masters.clear();
                        di.last_check = 0;
                        di.notified_serial = 0;
@@ -212,12 +212,12 @@ bool OdbxBackend::getSOA( const DNSName& domain, SOAData& sd, DNSPacket* p )
 
                        if( sd.nameserver.empty() )
                        {
-                               sd.nameserver = arg()["default-soa-name"];
+                               sd.nameserver = DNSName(arg()["default-soa-name"]);
                        }
 
                        if( sd.hostmaster.empty() )
                        {
-                               sd.hostmaster = "hostmaster." + domain;
+                               sd.hostmaster = DNSName("hostmaster") + DNSName(domain);
                        }
 
                        sd.db = this;
@@ -365,7 +365,7 @@ bool OdbxBackend::get( DNSResourceRecord& rr )
 
                        if( m_qname.empty() && ( tmp = odbx_field_value( m_result, 1 ) ) != NULL )
                        {
-                               rr.qname = string( tmp, odbx_field_length( m_result, 1 ) );
+                               rr.qname = DNSName( tmp, odbx_field_length( m_result, 1 ) );
                        }
 
                        if( ( tmp = odbx_field_value( m_result, 2 ) ) != NULL )
index 399f5f076e8be3b13469f6b10d64036d21ce5267..52143fadc00e7bcabcdf31c2dcf96bd455caf3ef 100644 (file)
@@ -215,7 +215,7 @@ bool OdbxBackend::getDomainList( const string& stmt, vector<DomainInfo>* list, b
 
                        if( ( tmp = odbx_field_value( m_result, 1 ) ) != NULL )
                        {
-                               di.zone = string( tmp, odbx_field_length( m_result, 1 ) );
+                               di.zone = DNSName( tmp, odbx_field_length( m_result, 1 ) );
                        }
 
                        if( ( tmp = odbx_field_value( m_result, 0 ) ) != NULL )