Skip to content

Instantly share code, notes, and snippets.

@Habbie
Created April 26, 2013 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Habbie/5466704 to your computer and use it in GitHub Desktop.
Save Habbie/5466704 to your computer and use it in GitHub Desktop.
Patch adding the missing getDomainInfo implementation
--- 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 */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment