@@ -78,8 +78,9 @@ static apr_status_t load_ldap(apr_pool_t *pool, const apr_ldap_driver_t **driver
78
78
modname = "apr_ldap-" APR_STRINGIFY (APR_MAJOR_VERSION ) ".so" ;
79
79
#endif
80
80
rv = apu_dso_load (NULL , & symbol , modname , "apr__ldap_fns" , pool , err );
81
- if (rv == APR_SUCCESS ) {
81
+ if (rv == APR_SUCCESS || APR_EINIT == rv ) {
82
82
lfn = symbol ;
83
+ rv = APR_SUCCESS ;
83
84
}
84
85
85
86
if (driver ) {
@@ -91,10 +92,17 @@ static apr_status_t load_ldap(apr_pool_t *pool, const apr_ldap_driver_t **driver
91
92
return rv ;
92
93
}
93
94
94
- #define LOAD_LDAP_STUB (pool , err , failres ) \
95
+ #define LOAD_LEGACY_STUB (pool , err , failres ) \
95
96
if (!lfn && (apr_ldap_get_driver(pool, NULL, err) != APR_SUCCESS)) \
96
97
return failres;
97
98
99
+ #define LOAD_LDAP_STUB (pool , err ) \
100
+ { \
101
+ apr_status_t status; \
102
+ if (!lfn && ((status = apr_ldap_get_driver(pool, NULL, err)) != APR_SUCCESS)) \
103
+ return status; \
104
+ }
105
+
98
106
#define CHECK_LDAP_STUB (failres ) \
99
107
if (!lfn) \
100
108
return failres;
@@ -131,7 +139,7 @@ APU_DECLARE(apr_status_t) apr_ldap_get_driver(apr_pool_t *pool,
131
139
APU_DECLARE_LDAP (int ) apr_ldap_info (apr_pool_t * pool ,
132
140
apr_ldap_err_t * * result_err )
133
141
{
134
- LOAD_LDAP_STUB (pool , NULL , -1 );
142
+ LOAD_LEGACY_STUB (pool , NULL , -1 );
135
143
return lfn -> info (pool , result_err );
136
144
}
137
145
@@ -142,7 +150,7 @@ APU_DECLARE_LDAP(int) apr_ldap_init(apr_pool_t *pool,
142
150
int secure ,
143
151
apr_ldap_err_t * * result_err )
144
152
{
145
- LOAD_LDAP_STUB (pool , NULL , -1 );
153
+ LOAD_LEGACY_STUB (pool , NULL , -1 );
146
154
return lfn -> init (pool , ldap , hostname , portno , secure , result_err );
147
155
}
148
156
@@ -151,7 +159,7 @@ APU_DECLARE_LDAP(int) apr_ldap_ssl_init(apr_pool_t *pool,
151
159
int cert_file_type ,
152
160
apr_ldap_err_t * * result_err )
153
161
{
154
- LOAD_LDAP_STUB (pool , NULL , -1 );
162
+ LOAD_LEGACY_STUB (pool , NULL , -1 );
155
163
return lfn -> ssl_init (pool , cert_auth_file , cert_file_type , result_err );
156
164
}
157
165
@@ -168,7 +176,7 @@ APU_DECLARE_LDAP(int) apr_ldap_get_option(apr_pool_t *pool,
168
176
void * outvalue ,
169
177
apr_ldap_err_t * * result_err )
170
178
{
171
- LOAD_LDAP_STUB (pool , NULL , -1 );
179
+ LOAD_LEGACY_STUB (pool , NULL , -1 );
172
180
return lfn -> get_option (pool , ldap , option , outvalue , result_err );
173
181
}
174
182
@@ -178,13 +186,13 @@ APU_DECLARE_LDAP(int) apr_ldap_set_option(apr_pool_t *pool,
178
186
const void * invalue ,
179
187
apr_ldap_err_t * * result_err )
180
188
{
181
- LOAD_LDAP_STUB (pool , NULL , -1 );
189
+ LOAD_LEGACY_STUB (pool , NULL , -1 );
182
190
return lfn -> set_option (pool , ldap , option , invalue , result_err );
183
191
}
184
192
185
193
APU_DECLARE_LDAP (apr_status_t ) apr_ldap_rebind_init (apr_pool_t * pool )
186
194
{
187
- LOAD_LDAP_STUB (pool , NULL , APR_EGENERAL );
195
+ LOAD_LEGACY_STUB (pool , NULL , APR_EGENERAL );
188
196
return lfn -> rebind_init (pool );
189
197
}
190
198
@@ -193,7 +201,7 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_add(apr_pool_t *pool,
193
201
const char * bindDN ,
194
202
const char * bindPW )
195
203
{
196
- LOAD_LDAP_STUB (pool , NULL , APR_EGENERAL );
204
+ LOAD_LEGACY_STUB (pool , NULL , APR_EGENERAL );
197
205
return lfn -> rebind_add (pool , ld , bindDN , bindPW );
198
206
}
199
207
@@ -210,7 +218,7 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_initialise(apr_pool_t *pool,
210
218
apr_ldap_t * * ldap ,
211
219
apu_err_t * err )
212
220
{
213
- LOAD_LDAP_STUB (pool , err , APR_EINIT );
221
+ LOAD_LDAP_STUB (pool , err );
214
222
return lfn -> initialise (pool , ldap , err );
215
223
}
216
224
@@ -220,7 +228,7 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_option_get(apr_pool_t *pool,
220
228
apr_ldap_opt_t * outvalue ,
221
229
apu_err_t * err )
222
230
{
223
- LOAD_LDAP_STUB (pool , err , APR_EINIT );
231
+ LOAD_LDAP_STUB (pool , err );
224
232
return lfn -> option_get (pool , ldap , option , outvalue , err );
225
233
}
226
234
@@ -230,7 +238,7 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_option_set(apr_pool_t *pool,
230
238
const apr_ldap_opt_t * invalue ,
231
239
apu_err_t * err )
232
240
{
233
- LOAD_LDAP_STUB (pool , err , APR_EINIT );
241
+ LOAD_LDAP_STUB (pool , err );
234
242
return lfn -> option_set (pool , ldap , option , invalue , err );
235
243
}
236
244
0 commit comments