apr_ldap.h revision 296373
1/* $FreeBSD: releng/10.3/usr.bin/svn/lib/libapr_util/apr_ldap.h 252454 2013-07-01 07:00:12Z peter $ */
2/* Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * apr_ldap.h is generated from apr_ldap.h.in by configure -- do not edit apr_ldap.h
20 */
21/**
22 * @file apr_ldap.h
23 * @brief  APR-UTIL LDAP
24 */
25#ifndef APU_LDAP_H
26#define APU_LDAP_H
27
28/**
29 * @defgroup APR_Util_LDAP LDAP
30 * @ingroup APR_Util
31 * @{
32 */
33
34/* this will be defined if LDAP support was compiled into apr-util */
35#define APR_HAS_LDAP		  0
36
37/* identify the LDAP toolkit used */
38#define APR_HAS_NETSCAPE_LDAPSDK  0
39#define APR_HAS_SOLARIS_LDAPSDK   0
40#define APR_HAS_NOVELL_LDAPSDK    0
41#define APR_HAS_MOZILLA_LDAPSDK   0
42#define APR_HAS_OPENLDAP_LDAPSDK  0
43#define APR_HAS_MICROSOFT_LDAPSDK 0
44#define APR_HAS_TIVOLI_LDAPSDK    0
45#define APR_HAS_ZOS_LDAPSDK       0
46#define APR_HAS_OTHER_LDAPSDK     0
47
48
49/*
50 * Handle the case when LDAP is enabled
51 */
52#if APR_HAS_LDAP
53
54/*
55 * The following #defines are DEPRECATED and should not be used for
56 * anything. They remain to maintain binary compatibility.
57 * The original code defined the OPENLDAP SDK as present regardless
58 * of what really was there, which was way bogus. In addition, the
59 * apr_ldap_url_parse*() functions have been rewritten specifically for
60 * APR, so the APR_HAS_LDAP_URL_PARSE macro is forced to zero.
61 */
62#if APR_HAS_TIVOLI_LDAPSDK
63#define APR_HAS_LDAP_SSL 0
64#else
65#define APR_HAS_LDAP_SSL 1
66#endif
67#define APR_HAS_LDAP_URL_PARSE      0
68
69#if APR_HAS_OPENLDAP_LDAPSDK && !defined(LDAP_DEPRECATED)
70/* Ensure that the "deprecated" interfaces are still exposed
71 * with OpenLDAP >= 2.3; these were exposed by default in earlier
72 * releases. */
73#define LDAP_DEPRECATED 1
74#endif
75
76/*
77 * Include the standard LDAP header files.
78 */
79
80
81
82
83
84
85/*
86 * Detected standard functions
87 */
88#define APR_HAS_LDAPSSL_CLIENT_INIT 0
89#define APR_HAS_LDAPSSL_CLIENT_DEINIT 0
90#define APR_HAS_LDAPSSL_ADD_TRUSTED_CERT 0
91#define APR_HAS_LDAP_START_TLS_S 0
92#define APR_HAS_LDAP_SSLINIT 0
93#define APR_HAS_LDAPSSL_INIT 0
94#define APR_HAS_LDAPSSL_INSTALL_ROUTINES 0
95
96/*
97 * Make sure the secure LDAP port is defined
98 */
99#ifndef LDAPS_PORT
100#define LDAPS_PORT 636  /* ldaps:/// default LDAP over TLS port */
101#endif
102
103/*
104 * For ldap function calls that input a size limit on the number of returned elements
105 * Some SDKs do not have the define for LDAP_DEFAULT_LIMIT (-1) or LDAP_NO_LIMIT (0)
106 * LDAP_DEFAULT_LIMIT is preferred as it allows inheritance from whatever the SDK
107 * or process is configured for.
108 */
109#ifdef LDAP_DEFAULT_LIMIT
110#define APR_LDAP_SIZELIMIT LDAP_DEFAULT_LIMIT
111#else
112#ifdef LDAP_NO_LIMIT
113#define APR_LDAP_SIZELIMIT LDAP_NO_LIMIT
114#endif
115#endif
116
117#ifndef APR_LDAP_SIZELIMIT
118#define APR_LDAP_SIZELIMIT 0 /* equivalent to LDAP_NO_LIMIT, and what goes on the wire */
119#endif
120
121/*
122 * z/OS is missing some defines
123 */
124#ifndef LDAP_VERSION_MAX
125#define LDAP_VERSION_MAX  LDAP_VERSION
126#endif
127#if APR_HAS_ZOS_LDAPSDK
128#define LDAP_VENDOR_NAME "IBM z/OS"
129#endif
130
131/* Note: Macros defining const casting has been removed in APR v1.0,
132 * pending real support for LDAP v2.0 toolkits.
133 *
134 * In the mean time, please use an LDAP v3.0 toolkit.
135 */
136#if LDAP_VERSION_MAX <= 2
137#error Support for LDAP v2.0 toolkits has been removed from apr-util. Please use an LDAP v3.0 toolkit.
138#endif
139
140#ifdef __cplusplus
141extern "C" {
142#endif /* __cplusplus */
143
144/**
145 * This structure allows the C LDAP API error codes to be returned
146 * along with plain text error messages that explain to us mere mortals
147 * what really happened.
148 */
149typedef struct apr_ldap_err_t {
150    const char *reason;
151    const char *msg;
152    int rc;
153} apr_ldap_err_t;
154
155#ifdef __cplusplus
156}
157#endif
158
159/* The MS SDK returns LDAP_UNAVAILABLE when the backend has closed the connection
160 * between LDAP calls. Protect with APR_HAS_MICROSOFT_LDAPSDK in case someone
161 * manually chooses another SDK on Windows
162 */
163#if APR_HAS_MICROSOFT_LDAPSDK
164#define APR_LDAP_IS_SERVER_DOWN(s)    ((s) == LDAP_SERVER_DOWN \
165                                    || (s) == LDAP_UNAVAILABLE)
166#else
167#define APR_LDAP_IS_SERVER_DOWN(s)    ((s) == LDAP_SERVER_DOWN)
168#endif
169
170/* These symbols are not actually exported in a DSO build, but mapped into
171 * a private exported function array for apr_ldap_stub to bind dynamically.
172 * Rename them appropriately to protect the global namespace.
173 */
174#ifdef APU_DSO_LDAP_BUILD
175
176#define apr_ldap_info apr__ldap_info
177#define apr_ldap_init apr__ldap_init
178#define apr_ldap_ssl_init apr__ldap_ssl_init
179#define apr_ldap_ssl_deinit apr__ldap_ssl_deinit
180#define apr_ldap_get_option apr__ldap_get_option
181#define apr_ldap_set_option apr__ldap_set_option
182#define apr_ldap_rebind_init apr__ldap_rebind_init
183#define apr_ldap_rebind_add apr__ldap_rebind_add
184#define apr_ldap_rebind_remove apr__ldap_rebind_remove
185
186#define APU_DECLARE_LDAP(type) type
187#else
188#define APU_DECLARE_LDAP(type) APU_DECLARE(type)
189#endif
190
191#include "apr_ldap_url.h"
192#include "apr_ldap_init.h"
193#include "apr_ldap_option.h"
194#include "apr_ldap_rebind.h"
195
196#endif /* APR_HAS_LDAP */
197/** @} */
198#endif /* APU_LDAP_H */
199