Apache HTTPD
apr_ldap_stub.c
Go to the documentation of this file.
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#include "apr.h"
18#include "apu.h"
19#include "apu_config.h"
20#include "apr_ldap.h"
21#include "apu_internal.h"
22#include "apr_dso.h"
23#include "apr_errno.h"
24#include "apr_pools.h"
25#include "apr_strings.h"
26#include "apu_version.h"
27
28#if APR_HAS_LDAP
29
30#if APU_DSO_BUILD
31
32static struct apr__ldap_dso_fntable *lfn = NULL;
33
35{
36 char *modname;
38 apr_status_t rv;
39
40 /* deprecate in 2.0 - permit implicit initialization */
42
43 rv = apu_dso_mutex_lock();
44 if (rv) {
45 return rv;
46 }
47
48#if defined(WIN32)
49 modname = "apr_ldap-" APU_STRINGIFY(APU_MAJOR_VERSION) ".dll";
50#else
51 modname = "apr_ldap-" APU_STRINGIFY(APU_MAJOR_VERSION) ".so";
52#endif
53 rv = apu_dso_load(NULL, &symbol, modname, "apr__ldap_fns", pool);
54 if (rv == APR_SUCCESS) {
55 lfn = symbol;
56 }
58
59 return rv;
60}
61
62#define LOAD_LDAP_STUB(pool, failres) \
63 if (!lfn && (load_ldap(pool) != APR_SUCCESS)) \
64 return failres;
65
68{
70 return lfn->info(pool, result_err);
71}
72
74 LDAP **ldap,
75 const char *hostname,
76 int portno,
77 int secure,
79{
81 return lfn->init(pool, ldap, hostname, portno, secure, result_err);
82}
83
85 const char *cert_auth_file,
88{
90 return lfn->ssl_init(pool, cert_auth_file, cert_file_type, result_err);
91}
92
94{
95 if (!lfn)
96 return -1;
97 return lfn->ssl_deinit();
98}
99
101 LDAP *ldap,
102 int option,
103 void *outvalue,
105{
106 LOAD_LDAP_STUB(pool, -1);
107 return lfn->get_option(pool, ldap, option, outvalue, result_err);
108}
109
111 LDAP *ldap,
112 int option,
113 const void *invalue,
115{
116 LOAD_LDAP_STUB(pool, -1);
117 return lfn->set_option(pool, ldap, option, invalue, result_err);
118}
119
121{
123 return lfn->rebind_init(pool);
124}
125
127 LDAP *ld,
128 const char *bindDN,
129 const char *bindPW)
130{
132 return lfn->rebind_add(pool, ld, bindDN, bindPW);
133}
134
136{
137 if (!lfn)
138 return APR_EGENERAL;
139 return lfn->rebind_remove(ld);
140}
141
142#endif /* APU_DSO_BUILD */
143
144#endif /* APR_HAS_LDAP */
145
APR Dynamic Object Handling Routines.
APR Error Codes.
APR memory allocation.
APR Strings library.
APR-util Versioning Interface.
#define APU_STRINGIFY(n)
Definition apu_version.h:87
#define APU_MAJOR_VERSION
Definition apu_version.h:53
const char * hostname
#define APR_EGENERAL
Definition apr_errno.h:313
apr_size_t size
const char int apr_pool_t * pool
Definition apr_cstr.h:84
#define APR_SUCCESS
Definition apr_errno.h:225
int apr_status_t
Definition apr_errno.h:44
return NULL
Definition mod_so.c:359