eaa127676b9ab36f3eeaf90ef17ba693715e3193
[obnox/samba/samba-obnox.git] / source3 / include / smb_ldap.h
1 /*
2    Unix SMB/CIFS implementation.
3    Copyright (C) Andrew Tridgell 2001
4    Copyright (C) Remus Koos 2001
5    Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002
6    Copyright (C) Guenther Deschner 2005
7    Copyright (C) Gerald Carter 2006
8
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 */
22
23 #ifndef _SMB_LDAP_H
24 #define _SMB_LDAP_H
25
26 #if HAVE_LBER_H
27 #include <lber.h>
28 #if defined(HPUX) && !defined(_LBER_TYPES_H)
29 /* Define ber_tag_t and ber_int_t for using
30  * HP LDAP-UX Integration products' LDAP libraries.
31 */
32 #ifndef ber_tag_t
33 typedef unsigned long ber_tag_t;
34 typedef int ber_int_t;
35 #endif
36 #endif /* defined(HPUX) && !defined(_LBER_TYPES_H) */
37 #ifndef LBER_USE_DER
38 #define LBER_USE_DER 0x01
39 #endif
40 #endif /* HAVE_LBER_H */
41
42 #if HAVE_LDAP_H
43 #include <ldap.h>
44 #ifndef LDAP_CONST
45 #define LDAP_CONST const
46 #endif
47
48 #ifdef HAVE_LDAP_PVT_H
49 #include <ldap_pvt.h>
50 #endif /* HAVE_LDAP_PVT_H */
51
52 /* Solaris 8 and maybe other LDAP implementations spell this "..._INPROGRESS": */
53 #if defined(LDAP_SASL_BIND_INPROGRESS) && !defined(LDAP_SASL_BIND_IN_PROGRESS)
54 #define LDAP_SASL_BIND_IN_PROGRESS LDAP_SASL_BIND_INPROGRESS
55 #endif
56 /* Solaris 8 defines SSL_LDAP_PORT, not LDAPS_PORT and it only does so if
57    LDAP_SSL is defined - but SSL is not working. We just want the
58    port number! Let's just define LDAPS_PORT correct. */
59 #if !defined(LDAPS_PORT)
60 #define LDAPS_PORT 636
61 #endif
62
63 #endif /* HAVE_LDAP_H */
64
65 #ifndef HAVE_LDAP
66 #define LDAP void
67 #define LDAPMessage void
68 #define LDAPMod void
69 #define LDAP_CONST const
70 #define LDAPControl void
71 struct berval;
72 struct ldapsam_privates;
73 #endif /* HAVE_LDAP */
74
75 #ifndef LDAP_OPT_SUCCESS
76 #define LDAP_OPT_SUCCESS 0
77 #endif
78
79 #define LDAP_DEFAULT_TIMEOUT   15
80 #define LDAP_CONNECTION_DEFAULT_TIMEOUT 2
81 #define LDAP_PAGE_SIZE 1024
82
83 #define ADS_PAGE_CTL_OID        "1.2.840.113556.1.4.319"
84
85 /*
86  * Work around versions of the LDAP client libs that don't have the OIDs
87  * defined, or have them defined under the old name.
88  * This functionality is really a factor of the server, not the client
89  *
90  */
91
92 #if defined(LDAP_EXOP_X_MODIFY_PASSWD) && !defined(LDAP_EXOP_MODIFY_PASSWD)
93 #define LDAP_EXOP_MODIFY_PASSWD LDAP_EXOP_X_MODIFY_PASSWD
94 #elif !defined(LDAP_EXOP_MODIFY_PASSWD)
95 #define LDAP_EXOP_MODIFY_PASSWD "1.3.6.1.4.1.4203.1.11.1"
96 #endif
97
98 #if defined(LDAP_EXOP_X_MODIFY_PASSWD_ID) && !defined(LDAP_EXOP_MODIFY_PASSWD_ID)
99 #define LDAP_TAG_EXOP_MODIFY_PASSWD_ID LDAP_EXOP_X_MODIFY_PASSWD_ID
100 #elif !defined(LDAP_EXOP_MODIFY_PASSWD_ID)
101 #define LDAP_TAG_EXOP_MODIFY_PASSWD_ID        ((ber_tag_t) 0x80U)
102 #endif
103
104 #if defined(LDAP_EXOP_X_MODIFY_PASSWD_NEW) && !defined(LDAP_EXOP_MODIFY_PASSWD_NEW)
105 #define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW LDAP_EXOP_X_MODIFY_PASSWD_NEW
106 #elif !defined(LDAP_EXOP_MODIFY_PASSWD_NEW)
107 #define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW       ((ber_tag_t) 0x82U)
108 #endif
109
110 #endif /* _SMB_LDAP_H */