Apache Portable Runtime Utility Library
include/apr_ldap.h
Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 /*
00018  * apr_ldap.h is generated from apr_ldap.h.in by configure -- do not edit apr_ldap.h
00019  */
00024 #ifndef APU_LDAP_H
00025 #define APU_LDAP_H
00026 
00033 /* this will be defined if LDAP support was compiled into apr-util */
00034 #define APR_HAS_LDAP              1
00035 
00036 /* identify the LDAP toolkit used */
00037 #define APR_HAS_NETSCAPE_LDAPSDK  0
00038 #define APR_HAS_SOLARIS_LDAPSDK   0
00039 #define APR_HAS_NOVELL_LDAPSDK    0
00040 #define APR_HAS_MOZILLA_LDAPSDK   0
00041 #define APR_HAS_OPENLDAP_LDAPSDK  1
00042 #define APR_HAS_MICROSOFT_LDAPSDK 0
00043 #define APR_HAS_TIVOLI_LDAPSDK    0
00044 #define APR_HAS_ZOS_LDAPSDK       0
00045 #define APR_HAS_OTHER_LDAPSDK     0
00046 
00047 
00048 /*
00049  * Handle the case when LDAP is enabled
00050  */
00051 #if APR_HAS_LDAP
00052 
00053 /*
00054  * The following #defines are DEPRECATED and should not be used for
00055  * anything. They remain to maintain binary compatibility.
00056  * The original code defined the OPENLDAP SDK as present regardless
00057  * of what really was there, which was way bogus. In addition, the
00058  * apr_ldap_url_parse*() functions have been rewritten specifically for
00059  * APR, so the APR_HAS_LDAP_URL_PARSE macro is forced to zero.
00060  */
00061 #if APR_HAS_TIVOLI_LDAPSDK
00062 #define APR_HAS_LDAP_SSL 0
00063 #else
00064 #define APR_HAS_LDAP_SSL 1
00065 #endif
00066 #define APR_HAS_LDAP_URL_PARSE      0
00067 
00068 #if APR_HAS_OPENLDAP_LDAPSDK && !defined(LDAP_DEPRECATED) 
00069 /* Ensure that the "deprecated" interfaces are still exposed
00070  * with OpenLDAP >= 2.3; these were exposed by default in earlier
00071  * releases. */
00072 #define LDAP_DEPRECATED 1
00073 #endif
00074 
00075 /*
00076  * Include the standard LDAP header files.
00077  */
00078 
00079 #include <lber.h>
00080 #include <ldap.h>
00081 
00082 
00083 
00084 /*
00085  * Detected standard functions
00086  */
00087 #define APR_HAS_LDAPSSL_CLIENT_INIT 0
00088 #define APR_HAS_LDAPSSL_CLIENT_DEINIT 0
00089 #define APR_HAS_LDAPSSL_ADD_TRUSTED_CERT 0
00090 #define APR_HAS_LDAP_START_TLS_S 1
00091 #define APR_HAS_LDAP_SSLINIT 0
00092 #define APR_HAS_LDAPSSL_INIT 0
00093 #define APR_HAS_LDAPSSL_INSTALL_ROUTINES 0
00094 
00095 /*
00096  * Make sure the secure LDAP port is defined
00097  */
00098 #ifndef LDAPS_PORT
00099 #define LDAPS_PORT 636  /* ldaps:/// default LDAP over TLS port */
00100 #endif
00101 
00102 /*
00103  * For ldap function calls that input a size limit on the number of returned elements
00104  * Some SDKs do not have the define for LDAP_DEFAULT_LIMIT (-1) or LDAP_NO_LIMIT (0)
00105  * LDAP_DEFAULT_LIMIT is preferred as it allows inheritance from whatever the SDK
00106  * or process is configured for.
00107  */
00108 #ifdef LDAP_DEFAULT_LIMIT
00109 #define APR_LDAP_SIZELIMIT LDAP_DEFAULT_LIMIT
00110 #else
00111 #ifdef LDAP_NO_LIMIT
00112 #define APR_LDAP_SIZELIMIT LDAP_NO_LIMIT
00113 #endif
00114 #endif
00115 
00116 #ifndef APR_LDAP_SIZELIMIT
00117 #define APR_LDAP_SIZELIMIT 0 /* equivalent to LDAP_NO_LIMIT, and what goes on the wire */
00118 #endif
00119 
00120 /*
00121  * z/OS is missing some defines
00122  */
00123 #ifndef LDAP_VERSION_MAX
00124 #define LDAP_VERSION_MAX  LDAP_VERSION
00125 #endif
00126 #if APR_HAS_ZOS_LDAPSDK
00127 #define LDAP_VENDOR_NAME "IBM z/OS"
00128 #endif
00129 
00130 /* Note: Macros defining const casting has been removed in APR v1.0,
00131  * pending real support for LDAP v2.0 toolkits.
00132  *
00133  * In the mean time, please use an LDAP v3.0 toolkit.
00134  */
00135 #if LDAP_VERSION_MAX <= 2
00136 #error Support for LDAP v2.0 toolkits has been removed from apr-util. Please use an LDAP v3.0 toolkit.
00137 #endif 
00138 
00139 #ifdef __cplusplus
00140 extern "C" {
00141 #endif /* __cplusplus */
00142 
00148 typedef struct apr_ldap_err_t {
00149     const char *reason;
00150     const char *msg;
00151     int rc;
00152 } apr_ldap_err_t;
00153 
00154 #ifdef __cplusplus
00155 }
00156 #endif
00157 
00158 /* The MS SDK returns LDAP_UNAVAILABLE when the backend has closed the connection
00159  * between LDAP calls. Protect with APR_HAS_MICROSOFT_LDAPSDK in case someone 
00160  * manually chooses another SDK on Windows 
00161  */
00162 #if APR_HAS_MICROSOFT_LDAPSDK
00163 #define APR_LDAP_IS_SERVER_DOWN(s)    ((s) == LDAP_SERVER_DOWN \
00164                                     || (s) == LDAP_UNAVAILABLE)
00165 #else
00166 #define APR_LDAP_IS_SERVER_DOWN(s)    ((s) == LDAP_SERVER_DOWN)
00167 #endif
00168 
00169 /* These symbols are not actually exported in a DSO build, but mapped into
00170  * a private exported function array for apr_ldap_stub to bind dynamically.
00171  * Rename them appropriately to protect the global namespace.
00172  */
00173 #ifdef APU_DSO_LDAP_BUILD
00174 
00175 #define apr_ldap_info apr__ldap_info
00176 #define apr_ldap_init apr__ldap_init
00177 #define apr_ldap_ssl_init apr__ldap_ssl_init
00178 #define apr_ldap_ssl_deinit apr__ldap_ssl_deinit
00179 #define apr_ldap_get_option apr__ldap_get_option
00180 #define apr_ldap_set_option apr__ldap_set_option
00181 #define apr_ldap_rebind_init apr__ldap_rebind_init
00182 #define apr_ldap_rebind_add apr__ldap_rebind_add
00183 #define apr_ldap_rebind_remove apr__ldap_rebind_remove
00184 
00185 #define APU_DECLARE_LDAP(type) type
00186 #else
00187 #define APU_DECLARE_LDAP(type) APU_DECLARE(type)
00188 #endif
00189 
00190 #include "apr_ldap_url.h"
00191 #include "apr_ldap_init.h"
00192 #include "apr_ldap_option.h"
00193 #include "apr_ldap_rebind.h"
00194 
00195 #endif /* APR_HAS_LDAP */
00196 
00197 #endif /* APU_LDAP_H */
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines