2 * PowerDNS LDAP Connector
4 * By Norbert Sendetzky <norbert@linuxnetworks.de> (2003-2007)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
46 class LdapAuthenticator
;
54 list
<LDAPMessage
*> m_results
;
56 const string
getError( int rc
= -1 );
57 int waitResult( int msgid
= LDAP_RES_ANY
, int timeout
= 0, LDAPMessage
** result
= NULL
);
61 typedef map
<string
, vector
<string
> > sentry_t
;
62 typedef vector
<sentry_t
> sresult_t
;
64 PowerLDAP( const string
& hosts
= "ldap://127.0.0.1/", uint16_t port
= LDAP_PORT
, bool tls
= false );
69 void getOption( int option
, int* value
);
70 void setOption( int option
, int value
);
72 void bind( LdapAuthenticator
*authenticator
);
73 void bind( const string
& ldapbinddn
= "", const string
& ldapsecret
= "", int method
= LDAP_AUTH_SIMPLE
, int timeout
= 5 );
74 void simpleBind( const string
& ldapbinddn
= "", const string
& ldapsecret
= "" );
75 int search( const string
& base
, int scope
, const string
& filter
, const char** attr
= 0 );
76 void modify( const string
& dn
, LDAPMod
*mods
[], LDAPControl
**scontrols
= 0, LDAPControl
**ccontrols
= 0 );
78 bool getSearchEntry( int msgid
, sentry_t
& entry
, bool dn
= false, int timeout
= 5 );
79 void getSearchResults( int msgid
, sresult_t
& result
, bool dn
= false, int timeout
= 5 );
81 static const string
escape( const string
& tobe
);