diff options
author | minfrin <minfrin@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-07 19:48:02 +0000 |
---|---|---|
committer | minfrin <minfrin@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-07 19:48:02 +0000 |
commit | 903373a697b2dc46fb309f6795e03dc248e89321 (patch) | |
tree | b0389c392735093fc8735113612b6fc49a191406 | |
parent | 73d7136795c067af72021e07bdd44e3ca22a98ad (diff) | |
download | libapr-util-903373a697b2dc46fb309f6795e03dc248e89321.tar.gz |
Expose the apr_dso_handle_t when calling apu_dso_load, so that the
crypto code can call apr_dso_error and find out why the dso load
failed. The existing LDAP and DBD code ignores this, as their APIs
do not yet allow for errors to be returned.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/trunk@692924 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | CHANGES | 5 | ||||
-rw-r--r-- | dbd/apr_dbd.c | 10 | ||||
-rw-r--r-- | include/private/apu_internal.h | 4 | ||||
-rw-r--r-- | ldap/apr_ldap_stub.c | 2 | ||||
-rw-r--r-- | misc/apu_dso.c | 8 |
5 files changed, 20 insertions, 9 deletions
@@ -1,6 +1,11 @@ -*- coding: utf-8 -*- Changes with APR-util 1.4.0 + *) Expose the apr_dso_handle_t when calling apu_dso_load, so that the + crypto code can call apr_dso_error and find out why the dso load + failed. The existing LDAP and DBD code ignores this, as their APIs + do not yet allow for errors to be returned. [Graham Leggett] + *) Fix a segfault in the DBD testcase when the DBD modules were not present. [Graham Leggett] diff --git a/dbd/apr_dbd.c b/dbd/apr_dbd.c index b1c1b092..eace178c 100644 --- a/dbd/apr_dbd.c +++ b/dbd/apr_dbd.c @@ -39,7 +39,7 @@ static apr_hash_t *drivers = NULL; #if APR_HAS_THREADS /* deprecated, but required for existing providers. Existing and new * providers should be refactored to use a provider-specific mutex so - * that different providers do not block one another. + * that different providers do not block one another. * In APR 1.3 this is no longer used for dso module loading, and * apu_dso_mutex_[un]lock is used instead. * In APR 2.0 this should become entirely local to libaprutil-2.so and @@ -174,14 +174,14 @@ APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char *name, #if defined(NETWARE) apr_snprintf(modname, sizeof(modname), "dbd%s.nlm", name); #elif defined(WIN32) - apr_snprintf(modname, sizeof(modname), + apr_snprintf(modname, sizeof(modname), "apr_dbd_%s-" APU_STRINGIFY(APU_MAJOR_VERSION) ".dll", name); #else - apr_snprintf(modname, sizeof(modname), + apr_snprintf(modname, sizeof(modname), "apr_dbd_%s-" APU_STRINGIFY(APU_MAJOR_VERSION) ".so", name); #endif apr_snprintf(symname, sizeof(symname), "apr_dbd_%s_driver", name); - rv = apu_dso_load(&symbol, modname, symname, pool); + rv = apu_dso_load(NULL, &symbol, modname, symname, pool); if (rv != APR_SUCCESS) { /* APR_EDSOOPEN or APR_ESYMNOTFOUND? */ if (rv == APR_EINIT) { /* previously loaded?!? */ name = apr_pstrdup(pool, name); @@ -439,7 +439,7 @@ APU_DECLARE(int) apr_dbd_prepare(const apr_dbd_driver_t *driver, case 'c': t[i] = APR_DBD_TYPE_CLOB; q += 2; break; case 'n': t[i] = APR_DBD_TYPE_NULL; q += 2; break; } - } + } break; } q++; diff --git a/include/private/apu_internal.h b/include/private/apu_internal.h index c23498e1..c95c9d50 100644 --- a/include/private/apu_internal.h +++ b/include/private/apu_internal.h @@ -31,13 +31,13 @@ extern "C" { * continue to initialize modules by multiple threads, the caller * of apu_dso_load must lock first, and not unlock until any init * finalization is complete. - */ + */ apr_status_t apu_dso_init(apr_pool_t *pool); apr_status_t apu_dso_mutex_lock(void); apr_status_t apu_dso_mutex_unlock(void); -apr_status_t apu_dso_load(apr_dso_handle_sym_t *dsoptr, const char *module, +apr_status_t apu_dso_load(apr_dso_handle_t **dso, apr_dso_handle_sym_t *dsoptr, const char *module, const char *modsym, apr_pool_t *pool); #if APR_HAS_LDAP diff --git a/ldap/apr_ldap_stub.c b/ldap/apr_ldap_stub.c index 24bb0d28..e4c16729 100644 --- a/ldap/apr_ldap_stub.c +++ b/ldap/apr_ldap_stub.c @@ -52,7 +52,7 @@ static apr_status_t load_ldap(apr_pool_t *pool) #else modname = "apr_ldap-" APU_STRINGIFY(APU_MAJOR_VERSION) ".so"; #endif - rv = apu_dso_load(&symbol, modname, "apr__ldap_fns", pool); + rv = apu_dso_load(NULL, &symbol, modname, "apr__ldap_fns", pool); if (rv == APR_SUCCESS) { lfn = symbol; } diff --git a/misc/apu_dso.c b/misc/apu_dso.c index 22a9d392..829878a3 100644 --- a/misc/apu_dso.c +++ b/misc/apu_dso.c @@ -103,7 +103,7 @@ apr_status_t apu_dso_init(apr_pool_t *pool) } #if APR_HAS_DSO -apr_status_t apu_dso_load(apr_dso_handle_sym_t *dsoptr, const char *module, +apr_status_t apu_dso_load(apr_dso_handle_t **dlhandleptr, apr_dso_handle_sym_t *dsoptr, const char *module, const char *modsym, apr_pool_t *pool) { #if !APU_DSO_BUILD @@ -159,6 +159,9 @@ apr_status_t apu_dso_load(apr_dso_handle_sym_t *dsoptr, const char *module, apr_cpystrn(eos, module, sizeof(path) - (eos - path)); rv = apr_dso_load(&dlhandle, path, global); + if (dlhandleptr) { + *dlhandleptr = dlhandle; + } if (rv == APR_SUCCESS) { /* APR_EDSOOPEN */ break; } @@ -175,6 +178,9 @@ apr_status_t apu_dso_load(apr_dso_handle_sym_t *dsoptr, const char *module, apr_cpystrn(eos, module, sizeof(path) - (eos - path)); rv = apr_dso_load(&dlhandle, path, global); + if (dlhandleptr) { + *dlhandleptr = dlhandle; + } if (rv == APR_SUCCESS) { /* APR_EDSOOPEN */ break; } |