Hi all,

The current dso helper code in apr-util masks the apr_dso_handle_t structure from the caller, and in the process makes it impossible to call apr_dso_error to find the human readable error message for why the module failed to load.

The attached patch fixes this, making a change to the include/private/apu_internal.h header file to expose the apr_dso_handle_t structure.

The plan is to commit this to trunk only (1.4.x and later) - given that the header is private, does this break the ABI rules?

Regards,
Graham
--
Index: include/private/apu_internal.h
===================================================================
--- include/private/apu_internal.h      (revision 690544)
+++ include/private/apu_internal.h      (working copy)
@@ -31,13 +31,13 @@
  * 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
Index: dbd/apr_dbd.c
===================================================================
--- dbd/apr_dbd.c       (revision 690544)
+++ dbd/apr_dbd.c       (working copy)
@@ -39,7 +39,7 @@
 #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
@@ -148,6 +148,7 @@
 #if APU_DSO_BUILD
     char modname[32];
     char symname[34];
+    apr_dso_handle_t *dso;
     apr_dso_handle_sym_t symbol;
 #endif
     apr_status_t rv;
@@ -174,14 +175,14 @@
 #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(&dso, &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 +440,7 @@
                         case 'c': t[i] = APR_DBD_TYPE_CLOB;       q += 2; 
break;
                         case 'n': t[i] = APR_DBD_TYPE_NULL;       q += 2; 
break;
                         }
-                    } 
+                    }
                     break;
                 }
                 q++;
Index: ldap/apr_ldap_stub.c
===================================================================
--- ldap/apr_ldap_stub.c        (revision 690544)
+++ ldap/apr_ldap_stub.c        (working copy)
@@ -34,6 +34,7 @@
 static apr_status_t load_ldap(apr_pool_t *pool)
 {
     char *modname;
+    apr_dso_handle_t *dso;
     apr_dso_handle_sym_t symbol;
     apr_status_t rv;
 
@@ -52,7 +53,7 @@
 #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(&dso, &symbol, modname, "apr__ldap_fns", pool);
     if (rv == APR_SUCCESS) {
         lfn = symbol;
     }

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to