#! /bin/sh /usr/share/dpatch/dpatch-run ## ldapbackend-getdomaininfo.dpatch by ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Adds missing ability for the LDAP backend to detect available zones so ## DP: that it is able to notify zone changes to slave servers. --- pdns-2.9.17/modules/ldapbackend/ldapbackend.cc.orig 2005-11-02 12:23:58.409389244 +0100 +++ pdns-2.9.17/modules/ldapbackend/ldapbackend.cc 2005-11-02 12:24:42.602243705 +0100 @@ -437,6 +437,37 @@ +bool LdapBackend::getDomainInfo( const string& domain, DomainInfo& di ) +{ + string filter; + SOAData sd; + char* attronly[] = { "sOARecord", NULL }; + + + // search for SOARecord of domain + filter = "(&(associatedDomain=" + toLower( m_pldap->escape( domain ) ) + ")(SOARecord=*))"; + m_msgid = m_pldap->search( getArg( "basedn" ), LDAP_SCOPE_SUBTREE, filter, (const char**) attronly ); + m_pldap->getSearchEntry( m_msgid, m_result ); + + if( m_result.count( "sOARecord" ) && !m_result["sOARecord"].empty() ) + { + sd.serial = 0; + DNSPacket::fillSOAData( m_result["sOARecord"][0], sd ); + + di.id = 0; + di.serial = sd.serial; + di.zone = domain; + di.last_check = 0; + di.backend = this; + di.kind = DomainInfo::Master; + + return true; + } + + return false; +} + + class LdapFactory : public BackendFactory --- pdns-2.9.17/modules/ldapbackend/ldapbackend.hh.orig 2005-11-02 12:33:25.340550767 +0100 +++ pdns-2.9.17/modules/ldapbackend/ldapbackend.hh 2005-11-02 12:34:11.591119079 +0100 @@ -110,6 +110,7 @@ bool list( const string& target, int domain_id ); void lookup( const QType& qtype, const string& qdomain, DNSPacket* p = 0, int zoneid = -1 ); bool get( DNSResourceRecord& rr ); + bool getDomainInfo( const string& domain, DomainInfo& di ); }; #endif /* LDAPBACKEND_HH */