ap_ldap.h.in revision 5f103e27107c82224e1964fca6f91945199660d9
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/* Licensed to the Apache Software Foundation (ASF) under one or more
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * contributor license agreements. See the NOTICE file distributed with
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * this work for additional information regarding copyright ownership.
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * The ASF licenses this file to You under the Apache License, Version 2.0
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * (the "License"); you may not use this file except in compliance with
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * the License. You may obtain a copy of the License at
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton *
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * http://www.apache.org/licenses/LICENSE-2.0
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton *
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * Unless required by applicable law or agreed to in writing, software
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * distributed under the License is distributed on an "AS IS" BASIS,
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * See the License for the specific language governing permissions and
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * limitations under the License.
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/*
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * ap_ldap.h is generated from ap_ldap.h.in by configure -- do not edit ap_ldap.h
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/**
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * @file ap_ldap.h
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * @brief MODLDAP
292707b9868335763d6f2bb74a263134eeeb8cadkbrand */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#ifndef AP_LDAP_H
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_LDAP_H
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/**
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * @defgroup AP_Util_LDAP LDAP
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * @ingroup APR_Util
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * @{
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/* Create a set of LDAP_DECLARE macros with appropriate export
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * and import tags for the platform
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#if !defined(WIN32)
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define LDAP_DECLARE(type) type
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define LDAP_DECLARE_NONSTD(type) type
12b2973ae4fdb19829e3ccd9d5d3938451c67f41jorton#define LDAP_DECLARE_DATA
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#elif defined(LDAP_DECLARE_STATIC)
91ef999a69527d2a64983681c92aaef9270697b4rpluem#define LDAP_DECLARE(type) type __stdcall
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define LDAP_DECLARE_NONSTD(type) type
5bfaaf573bacb45c1cf290ce85ecc676587e8a64jim#define LDAP_DECLARE_DATA
338eb440128c076c0418429cbc4845148d52a09ejorton#elif defined(LDAP_DECLARE_EXPORT)
338eb440128c076c0418429cbc4845148d52a09ejorton#define LDAP_DECLARE(type) __declspec(dllexport) type __stdcall
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define LDAP_DECLARE_NONSTD(type) __declspec(dllexport) type
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define LDAP_DECLARE_DATA __declspec(dllexport)
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#else
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define LDAP_DECLARE(type) __declspec(dllimport) type __stdcall
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define LDAP_DECLARE_NONSTD(type) __declspec(dllimport) type
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define LDAP_DECLARE_DATA __declspec(dllimport)
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#endif
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/* this will be defined if LDAP support was compiled into apr-util */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_LDAP @ap_has_ldap@
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/* identify the LDAP toolkit used */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_NETSCAPE_LDAPSDK @ap_has_ldap_netscape@
5bfaaf573bacb45c1cf290ce85ecc676587e8a64jim#define AP_HAS_SOLARIS_LDAPSDK @ap_has_ldap_solaris@
0de29985d3f84de428d0744b9dafb8a6b086d034jorton#define AP_HAS_NOVELL_LDAPSDK @ap_has_ldap_novell@
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_MOZILLA_LDAPSDK @ap_has_ldap_mozilla@
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_OPENLDAP_LDAPSDK @ap_has_ldap_openldap@
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_MICROSOFT_LDAPSDK @ap_has_ldap_microsoft@
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_TIVOLI_LDAPSDK @ap_has_ldap_tivoli@
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_ZOS_LDAPSDK @ap_has_ldap_zos@
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_OTHER_LDAPSDK @ap_has_ldap_other@
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/*
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * Handle the case when LDAP is enabled
185aa71728867671e105178b4c66fbc22b65ae26sf */
5bfaaf573bacb45c1cf290ce85ecc676587e8a64jim#if AP_HAS_LDAP
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/*
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * The following #defines are DEPRECATED and should not be used for
5bfaaf573bacb45c1cf290ce85ecc676587e8a64jim * anything. They remain to maintain binary compatibility.
5bfaaf573bacb45c1cf290ce85ecc676587e8a64jim * The original code defined the OPENLDAP SDK as present regardless
185aa71728867671e105178b4c66fbc22b65ae26sf * of what really was there, which was way bogus. In addition, the
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * ap_ldap_url_parse*() functions have been rewritten specifically for
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * APR, so the AP_HAS_LDAP_URL_PARSE macro is forced to zero.
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#if AP_HAS_TIVOLI_LDAPSDK
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_LDAP_SSL 0
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#else
0de29985d3f84de428d0744b9dafb8a6b086d034jorton#define AP_HAS_LDAP_SSL 1
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#endif
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_LDAP_URL_PARSE 0
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#if AP_HAS_OPENLDAP_LDAPSDK && !defined(LDAP_DEPRECATED)
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/* Ensure that the "deprecated" interfaces are still exposed
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * with OpenLDAP >= 2.3; these were exposed by default in earlier
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * releases. */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define LDAP_DEPRECATED 1
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#endif
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
185aa71728867671e105178b4c66fbc22b65ae26sf/*
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * Include the standard LDAP header files.
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton@lber_h@
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton@ldap_h@
5bfaaf573bacb45c1cf290ce85ecc676587e8a64jim@ldap_ssl_h@
185aa71728867671e105178b4c66fbc22b65ae26sf
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/*
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * Detected standard functions
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_LDAPSSL_CLIENT_INIT @ap_has_ldapssl_client_init@
5bfaaf573bacb45c1cf290ce85ecc676587e8a64jim#define AP_HAS_LDAPSSL_CLIENT_DEINIT @ap_has_ldapssl_client_deinit@
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_LDAPSSL_ADD_TRUSTED_CERT @ap_has_ldapssl_add_trusted_cert@
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_LDAP_START_TLS_S @ap_has_ldap_start_tls_s@
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_LDAP_SSLINIT @ap_has_ldap_sslinit@
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_LDAPSSL_INIT @ap_has_ldapssl_init@
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_HAS_LDAPSSL_INSTALL_ROUTINES @ap_has_ldapssl_install_routines@
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/*
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * Make sure the secure LDAP port is defined
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#ifndef LDAPS_PORT
185aa71728867671e105178b4c66fbc22b65ae26sf#define LDAPS_PORT 636 /* ldaps:/// default LDAP over TLS port */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#endif
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/*
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * For ldap function calls that input a size limit on the number of returned elements
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * Some SDKs do not have the define for LDAP_DEFAULT_LIMIT (-1) or LDAP_NO_LIMIT (0)
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * LDAP_DEFAULT_LIMIT is preferred as it allows inheritance from whatever the SDK
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * or process is configured for.
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#ifdef LDAP_DEFAULT_LIMIT
a128f7088d23bc32870fc994b8acbeabb0845790jorton#define AP_LDAP_SIZELIMIT LDAP_DEFAULT_LIMIT
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#else
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#ifdef LDAP_NO_LIMIT
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_LDAP_SIZELIMIT LDAP_NO_LIMIT
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#endif
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#endif
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#ifndef AP_LDAP_SIZELIMIT
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_LDAP_SIZELIMIT 0 /* equivalent to LDAP_NO_LIMIT, and what goes on the wire */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#endif
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/*
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * z/OS is missing some defines
185aa71728867671e105178b4c66fbc22b65ae26sf */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#ifndef LDAP_VERSION_MAX
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define LDAP_VERSION_MAX LDAP_VERSION
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#endif
5bfaaf573bacb45c1cf290ce85ecc676587e8a64jim#if AP_HAS_ZOS_LDAPSDK
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define LDAP_VENDOR_NAME "IBM z/OS"
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#endif
185aa71728867671e105178b4c66fbc22b65ae26sf
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/* Note: Macros defining const casting has been removed in APR v1.0,
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * pending real support for LDAP v2.0 toolkits.
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton *
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * In the mean time, please use an LDAP v3.0 toolkit.
3efea4a958cbb2e193a2f34ba5afdfe216a34324jorton */
3efea4a958cbb2e193a2f34ba5afdfe216a34324jorton#if LDAP_VERSION_MAX <= 2
3efea4a958cbb2e193a2f34ba5afdfe216a34324jorton#error Support for LDAP v2.0 toolkits has been removed from apr-util. Please use an LDAP v3.0 toolkit.
3efea4a958cbb2e193a2f34ba5afdfe216a34324jorton#endif
3efea4a958cbb2e193a2f34ba5afdfe216a34324jorton
3efea4a958cbb2e193a2f34ba5afdfe216a34324jorton#ifdef __cplusplus
3efea4a958cbb2e193a2f34ba5afdfe216a34324jortonextern "C" {
185aa71728867671e105178b4c66fbc22b65ae26sf#endif /* __cplusplus */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/**
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * This structure allows the C LDAP API error codes to be returned
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * along with plain text error messages that explain to us mere mortals
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * what really happened.
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton */
39c7699ec0799d394d3f67145d4a12ed82f587b8jortontypedef struct ap_ldap_err_t {
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton const char *reason;
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton const char *msg;
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton int rc;
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton} ap_ldap_err_t;
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#ifdef __cplusplus
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton}
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#endif
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/* The MS SDK returns LDAP_UNAVAILABLE when the backend has closed the connection
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * between LDAP calls. Protect with AP_HAS_MICROSOFT_LDAPSDK in case someone
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton * manually chooses another SDK on Windows
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#if AP_HAS_MICROSOFT_LDAPSDK
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_LDAP_IS_SERVER_DOWN(s) ((s) == LDAP_SERVER_DOWN \
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton || (s) == LDAP_UNAVAILABLE)
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#else
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#define AP_LDAP_IS_SERVER_DOWN(s) ((s) == LDAP_SERVER_DOWN)
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#endif
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#include "ap_ldap_url.h"
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#include "ap_ldap_init.h"
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#include "ap_ldap_option.h"
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#include "ap_ldap_rebind.h"
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#endif /* AP_HAS_LDAP */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton/** @} */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton#endif /* AP_LDAP_H */
39c7699ec0799d394d3f67145d4a12ed82f587b8jorton