Add instruction about the use of --libdir
[pdns-ldap-backend/landonf.git] / src / ldapauthenticator_p.hh
blob9c3029222322679b43cf13597c611a1031d3712c
1 /*
2 * PowerDNS LDAP Backend
3 * Copyright (C) 2011 Grégory Oestreicher <greg@kamago.net>
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
19 #include "ldapauthenticator.hh"
21 #ifndef LDAPAUTHENTICATOR_P_HH
22 #define LDAPAUTHENTICATOR_P_HH
24 #ifndef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_DEFAULT_FLAGS
25 #define krb5_get_init_creds_opt_set_default_flags( a, b, c, d ) /* This does not exist with MIT Kerberos */
26 #endif
28 class LdapSimpleAuthenticator : public LdapAuthenticator
30 std::string binddn;
31 std::string bindpw;
32 int timeout;
33 std::string lastError;
35 void fillLastError( LDAP *conn, int code );
37 public:
38 LdapSimpleAuthenticator( const std::string &dn, const std::string &pw, int timeout );
39 virtual bool authenticate( LDAP *conn );
40 virtual std::string getError() const;
43 class LdapGssapiAuthenticator : public LdapAuthenticator
45 std::string keytabFile;
46 std::string cCacheFile;
47 int timeout;
48 std::string lastError;
50 struct SaslDefaults {
51 std::string mech;
52 std::string realm;
53 std::string authcid;
54 std::string authzid;
57 int attemptAuth( LDAP *conn );
58 int updateTgt();
60 public:
61 LdapGssapiAuthenticator( const std::string &keytab, const std::string &credsCache, int timeout );
62 virtual bool authenticate( LDAP *conn );
63 virtual std::string getError() const;
66 #endif // LDAPAUTHENTICATOR_P_HH