svn commit: r1924470 - /apr/apr-util/branches/1.7.x/ldap/apr_ldap_stub.c
[email protected] Wed, 19 Mar 2025 14:24:20 -0000
Newsgroups
gmane.comp.apache.apr.cvs
Message-ID
<[email protected] >
Author: minfrin
Date: Wed Mar 19 14:24:20 2025
New Revision: 1924470
URL: http://svn.apache.org/viewvc?rev=1924470&view=rev
Log:
apr_ldap: Make sure APR_EINIT returned when the DSO is already loaded
does not get returned as an error. Make sure DSO errors are passed
accurately to the caller for all new API functions, leaving legacy
API unchanged.
Modified:
apr/apr-util/branches/1.7.x/ldap/apr_ldap_stub.c
Modified: apr/apr-util/branches/1.7.x/ldap/apr_ldap_stub.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.7.x/ldap/apr_ldap_stub.c?rev=1924470&r1=1924469&r2=1924470&view=diff
==============================================================================
--- apr/apr-util/branches/1.7.x/ldap/apr_ldap_stub.c (original)
+++ apr/apr-util/branches/1.7.x/ldap/apr_ldap_stub.c Wed Mar 19 14:24:20 2025
@@ -78,8 +78,9 @@ static apr_status_t load_ldap(apr_pool_t
modname = "apr_ldap-" APR_STRINGIFY(APR_MAJOR_VERSION) ".so";
#endif
rv = apu_dso_load(NULL, &symbol, modname, "apr__ldap_fns", pool, err);
- if (rv == APR_SUCCESS) {
+ if (rv == APR_SUCCESS || APR_EINIT == rv) {
lfn = symbol;
+ rv = APR_SUCCESS;
}
if (driver) {
@@ -91,10 +92,17 @@ static apr_status_t load_ldap(apr_pool_t
return rv;
}
-#define LOAD_LDAP_STUB(pool, err, failres) \
+#define LOAD_LEGACY_STUB(pool, err, failres) \
if (!lfn && (apr_ldap_get_driver(pool, NULL, err) != APR_SUCCESS)) \
return failres;
+#define LOAD_LDAP_STUB(pool, err) \
+ { \
+ apr_status_t status; \
+ if (!lfn && ((status = apr_ldap_get_driver(pool, NULL, err)) != APR_SUCCESS)) \
+ return status; \
+ }
+
#define CHECK_LDAP_STUB(failres) \
if (!lfn) \
return failres;
@@ -131,7 +139,7 @@ APU_DECLARE(apr_status_t) apr_ldap_get_d
APU_DECLARE_LDAP(int) apr_ldap_info(apr_pool_t *pool,
apr_ldap_err_t **result_err)
{
- LOAD_LDAP_STUB(pool, NULL, -1);
+ LOAD_LEGACY_STUB(pool, NULL, -1);
return lfn->info(pool, result_err);
}
@@ -142,7 +150,7 @@ APU_DECLARE_LDAP(int) apr_ldap_init(apr_
int secure,
apr_ldap_err_t **result_err)
{
- LOAD_LDAP_STUB(pool, NULL, -1);
+ LOAD_LEGACY_STUB(pool, NULL, -1);
return lfn->init(pool, ldap, hostname, portno, secure, result_err);
}
@@ -151,7 +159,7 @@ APU_DECLARE_LDAP(int) apr_ldap_ssl_init(
int cert_file_type,
apr_ldap_err_t **result_err)
{
- LOAD_LDAP_STUB(pool, NULL, -1);
+ LOAD_LEGACY_STUB(pool, NULL, -1);
return lfn->ssl_init(pool, cert_auth_file, cert_file_type, result_err);
}
@@ -168,7 +176,7 @@ APU_DECLARE_LDAP(int) apr_ldap_get_optio
void *outvalue,
apr_ldap_err_t **result_err)
{
- LOAD_LDAP_STUB(pool, NULL, -1);
+ LOAD_LEGACY_STUB(pool, NULL, -1);
return lfn->get_option(pool, ldap, option, outvalue, result_err);
}
@@ -178,13 +186,13 @@ APU_DECLARE_LDAP(int) apr_ldap_set_optio
const void *invalue,
apr_ldap_err_t **result_err)
{
- LOAD_LDAP_STUB(pool, NULL, -1);
+ LOAD_LEGACY_STUB(pool, NULL, -1);
return lfn->set_option(pool, ldap, option, invalue, result_err);
}
APU_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_init(apr_pool_t *pool)
{
- LOAD_LDAP_STUB(pool, NULL, APR_EGENERAL);
+ LOAD_LEGACY_STUB(pool, NULL, APR_EGENERAL);
return lfn->rebind_init(pool);
}
@@ -193,7 +201,7 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_
const char *bindDN,
const char *bindPW)
{
- LOAD_LDAP_STUB(pool, NULL, APR_EGENERAL);
+ LOAD_LEGACY_STUB(pool, NULL, APR_EGENERAL);
return lfn->rebind_add(pool, ld, bindDN, bindPW);
}
@@ -210,7 +218,7 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_
apr_ldap_t **ldap,
apu_err_t *err)
{
- LOAD_LDAP_STUB(pool, err, APR_EINIT);
+ LOAD_LDAP_STUB(pool, err);
return lfn->initialise(pool, ldap, err);
}
@@ -220,7 +228,7 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_
apr_ldap_opt_t *outvalue,
apu_err_t *err)
{
- LOAD_LDAP_STUB(pool, err, APR_EINIT);
+ LOAD_LDAP_STUB(pool, err);
return lfn->option_get(pool, ldap, option, outvalue, err);
}
@@ -230,7 +238,7 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_
const apr_ldap_opt_t *invalue,
apu_err_t *err)
{
- LOAD_LDAP_STUB(pool, err, APR_EINIT);
+ LOAD_LDAP_STUB(pool, err);
return lfn->option_set(pool, ldap, option, invalue, err);
}