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