[Pdns-dev] Re: [postmaster@ds9a.nl: [PowerDNS]_#37:_Missing_getDomainInfo_in_LDAP_backend]

Norbert Sendetzky norbert at linuxnetworks.de
Sat Oct 29 15:21:29 CEST 2005


On Wednesday 26 October 2005 21:07, bert hubert wrote:
>- Because the LDAP backend lacks the getDomainInfo backend, a manual notify
> via pdns_control does not work.  However this is the only way atm to notify
> slave DNS servers of domains in LDAP changed.

I've written code for this a while ago but I'm not sure if it will work. In 
contrast the the db backends the ldapbackend can't store information about 
domains in the ldap tree. Therefore I would like to know if the code below is 
sufficient.

It tests for the existence of the SOA record for the domain and returns a 
mainly empty DomainInfo structure. DomainInfo.kind is always "Master" because 
"Slave" isn't supported (the backend is read-only) and "Native" replication 
is wrong in most cases.

bool LdapBackend::getDomainInfo( const string& domain, DomainInfo& di )
{
	string filter;
	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.empty() )
	{
		return false;
	}

	di.id = 0;
	di.zone = domain;
	di.last_check = 0;
	di.backend = this;
	di.kind = DomainInfo::Master;

	return true;
}

Do you think I forgot something?


Norbert
-- 
OpenPGP public key
http://www.linuxnetworks.de/norbert.pubkey.asc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mailman.powerdns.com/pipermail/pdns-dev/attachments/20051029/6762d5f9/attachment.bin


More information about the Pdns-dev mailing list