From: Peter van Dijk Date: Tue, 16 Jun 2015 11:49:58 +0000 (+0200) Subject: opendbx mostly works, except for the axfr test X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~58^2~21^2~5^2~33 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed56a9d748e217adc9a9525babfebbcdcc2dcca8;p=pdns opendbx mostly works, except for the axfr test --- diff --git a/modules/opendbxbackend/odbxbackend.cc b/modules/opendbxbackend/odbxbackend.cc index fd6cc1987..7c4e52133 100644 --- a/modules/opendbxbackend/odbxbackend.cc +++ b/modules/opendbxbackend/odbxbackend.cc @@ -169,7 +169,7 @@ bool OdbxBackend::getDomainInfo( const string& domain, DomainInfo& di ) -bool OdbxBackend::getSOA( const string& domain, SOAData& sd, DNSPacket* p ) +bool OdbxBackend::getSOA( const DNSName& domain, SOAData& sd, DNSPacket* p ) { const char* tmp; @@ -179,7 +179,7 @@ bool OdbxBackend::getSOA( const string& domain, SOAData& sd, DNSPacket* p ) DLOG( L.log( m_myname + " getSOA()", Logger::Debug ) ); string stmt = getArg( "sql-lookupsoa" ); - string& stmtref = strbind( ":name", escape( toLower( domain ), READ ), stmt ); + string& stmtref = strbind( ":name", escape( domain.toStringNoDot(), READ ), stmt ); if( !execStmt( stmtref.c_str(), stmtref.size(), READ ) ) { return false; } if( !getRecord( READ ) ) { return false; } @@ -198,7 +198,7 @@ bool OdbxBackend::getSOA( const string& domain, SOAData& sd, DNSPacket* p ) if( ( tmp = odbx_field_value( m_result, 2 ) ) != NULL ) { sd.ttl = strtoul( tmp, NULL, 10 ); - } + } if( sd.serial == 0 && ( tmp = odbx_field_value( m_result, 1 ) ) != NULL ) { @@ -235,7 +235,7 @@ bool OdbxBackend::getSOA( const string& domain, SOAData& sd, DNSPacket* p ) -bool OdbxBackend::list( const string& target, int zoneid, bool include_disabled ) +bool OdbxBackend::list( const DNSName& target, int zoneid, bool include_disabled ) { try { @@ -274,7 +274,7 @@ bool OdbxBackend::list( const string& target, int zoneid, bool include_disabled -void OdbxBackend::lookup( const QType& qtype, const string& qname, DNSPacket* dnspkt, int zoneid ) +void OdbxBackend::lookup( const QType& qtype, const DNSName& qname, DNSPacket* dnspkt, int zoneid ) { try { @@ -323,7 +323,7 @@ void OdbxBackend::lookup( const QType& qtype, const string& qname, DNSPacket* dn stmtref = strbind( ":id", string( m_buffer, len ), stmtref ); } - string tmp = qname; + string tmp = qname.toStringNoDot(); stmtref = strbind( ":name", escape( toLowerByRef( tmp ), READ ), stmtref ); if( !execStmt( stmtref.c_str(), stmtref.size(), READ ) ) @@ -664,7 +664,7 @@ bool OdbxBackend::feedRecord( const DNSResourceRecord& rr, string *ordername ) return false; } - string tmp = rr.qname; + string tmp = rr.qname.toStringNoDot(); int priority=0; string content(rr.content); diff --git a/modules/opendbxbackend/odbxbackend.hh b/modules/opendbxbackend/odbxbackend.hh index 4801a2931..58dab55c1 100644 --- a/modules/opendbxbackend/odbxbackend.hh +++ b/modules/opendbxbackend/odbxbackend.hh @@ -54,7 +54,7 @@ class OdbxBackend : public DNSBackend enum QueryType { READ, WRITE }; string m_myname; - string m_qname; + DNSName m_qname; int m_default_ttl; bool m_qlog; odbx_t* m_handle[2]; @@ -75,9 +75,9 @@ public: OdbxBackend( const string& suffix="" ); ~OdbxBackend(); - void lookup( const QType& qtype, const string& qdomain, DNSPacket* p = 0, int zoneid = -1 ); - bool getSOA( const string& domain, SOAData& sd, DNSPacket* p ); - bool list( const string& target, int domain_id, bool include_disabled=false ); + void lookup( const QType& qtype, const DNSName& qdomain, DNSPacket* p = 0, int zoneid = -1 ); + bool getSOA( const DNSName& domain, SOAData& sd, DNSPacket* p ); + bool list( const DNSName& target, int domain_id, bool include_disabled=false ); bool get( DNSResourceRecord& rr ); bool startTransaction( const string& domain, int domain_id );