GME  13
apr_ldap_init.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 
00021 #ifndef APR_LDAP_INIT_H
00022 #define APR_LDAP_INIT_H
00023 
00029 #include "apr_ldap.h"
00030 
00031 #if APR_HAS_LDAP
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif /* __cplusplus */
00036 
00037 
00041 #if defined(LDAP_INSUFFICIENT_ACCESS)
00042 #define APU_LDAP_INSUFFICIENT_ACCESS LDAP_INSUFFICIENT_ACCESS
00043 #elif defined(LDAP_INSUFFICIENT_RIGHTS)
00044 #define APU_LDAP_INSUFFICIENT_ACCESS LDAP_INSUFFICIENT_RIGHTS
00045 #elif defined(APR_HAS_MICROSOFT_LDAPSDK)
00046 /* The macros above fail to contemplate that LDAP_RETCODE values
00047  * may be represented by an enum.  autoconf tests would be much
00048  * more robust.
00049  */
00050 #define APU_LDAP_INSUFFICIENT_ACCESS LDAP_INSUFFICIENT_RIGHTS
00051 #else
00052 #error The security return codes must be added to support this LDAP toolkit.
00053 #endif
00054 
00055 #if defined(LDAP_SECURITY_ERROR)
00056 #define APU_LDAP_SECURITY_ERROR LDAP_SECURITY_ERROR
00057 #else
00058 #define APU_LDAP_SECURITY_ERROR(n)      \
00059     (LDAP_INAPPROPRIATE_AUTH == n) ? 1 \
00060     : (LDAP_INVALID_CREDENTIALS == n) ? 1 \
00061     : (APU_LDAP_INSUFFICIENT_ACCESS == n) ? 1 \
00062     : 0
00063 #endif
00064 
00065 
00089 APU_DECLARE_LDAP(int) apr_ldap_ssl_init(apr_pool_t *pool,
00090                                         const char *cert_auth_file,
00091                                         int cert_file_type,
00092                                         apr_ldap_err_t **result_err);
00093 
00103 APU_DECLARE_LDAP(int) apr_ldap_ssl_deinit(void);
00104 
00139 APU_DECLARE_LDAP(int) apr_ldap_init(apr_pool_t *pool,
00140                                     LDAP **ldap,
00141                                     const char *hostname,
00142                                     int portno,
00143                                     int secure,
00144                                     apr_ldap_err_t **result_err);
00145 
00154 APU_DECLARE_LDAP(int) apr_ldap_info(apr_pool_t *pool,
00155                                     apr_ldap_err_t **result_err);
00156 
00157 #ifdef __cplusplus
00158 }
00159 #endif
00160 
00161 #endif /* APR_HAS_LDAP */
00162 
00165 #endif /* APR_LDAP_URL_H */