2 * PowerDNS LDAP Backend
3 * Copyright (C) 2003-2007 Norbert Sendetzky <norbert@linuxnetworks.de>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 #include <pdns/dns.hh>
29 #include <pdns/utility.hh>
30 #include <pdns/dnspacket.hh>
31 #include <pdns/dnsbackend.hh>
32 #include <pdns/ueberbackend.hh>
33 #include <pdns/ahuexception.hh>
34 #include <pdns/arguments.hh>
35 #include <pdns/logger.hh>
36 #include "powerldap.hh"
44 #ifndef LDAPBACKEND_HH
45 #define LDAPBACKEND_HH
50 class LdapAuthenticator
;
54 * Types which aren't active are currently not supported by PDNS
57 static const char* ldap_attrany
[] = {
96 class LdapBackend
: public DNSBackend
102 uint32_t m_default_ttl
;
103 unsigned int m_axfrqlen
;
104 time_t m_last_modified
;
108 LdapAuthenticator
*m_authenticator
;
109 PowerLDAP::sentry_t m_result
;
110 PowerLDAP::sentry_t::iterator m_attribute
;
111 vector
<string
>::iterator m_value
, m_adomain
;
112 vector
<string
> m_adomains
;
113 int m_reconnect_attempts
;
115 bool (LdapBackend::*m_list_fcnt
)( const string
&, int );
116 void (LdapBackend::*m_lookup_fcnt
)( const QType
&, const string
&, DNSPacket
*, int );
117 bool (LdapBackend::*m_prepare_fcnt
)();
119 bool list_simple( const string
& target
, int domain_id
);
120 bool list_strict( const string
& target
, int domain_id
);
122 void lookup_simple( const QType
& qtype
, const string
& qdomain
, DNSPacket
* p
, int zoneid
);
123 void lookup_strict( const QType
& qtype
, const string
& qdomain
, DNSPacket
* p
, int zoneid
);
124 void lookup_tree( const QType
& qtype
, const string
& qdomain
, DNSPacket
* p
, int zoneid
);
127 bool prepare_simple();
128 bool prepare_strict();
130 bool getDomainInfo( const string
& domain
, DomainInfo
& di
);
136 LdapBackend( const string
&suffix
="" );
140 bool list( const string
& target
, int domain_id
);
141 void lookup( const QType
& qtype
, const string
& qdomain
, DNSPacket
* p
= 0, int zoneid
= -1 );
142 bool get( DNSResourceRecord
& rr
);
145 void getUpdatedMasters( vector
<DomainInfo
>* domains
);
146 void setNotified( uint32_t id
, uint32_t serial
);
149 #endif /* LDAPBACKEND_HH */