Index: ldap/apr_ldap_stub.c =================================================================== --- ldap/apr_ldap_stub.c (revision 0) +++ ldap/apr_ldap_stub.c (revision 0) @@ -0,0 +1,149 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "apr.h" +#include "apu.h" +#include "apu_config.h" +#include "apr_ldap.h" +#include "apu_internal.h" +#include "apr_dso.h" +#include "apr_errno.h" +#include "apr_pools.h" +#include "apr_strings.h" + +#if APR_HAS_LDAP + +#if APU_DSO_BUILD + +static struct apr__ldap_dso_fntable *lfn = NULL; + +static apr_status_t load_ldap(apr_pool_t *pool) +{ + char *path; + apr_dso_handle_t *dlhandle = NULL; + apr_dso_handle_sym_t symbol; + apr_status_t rv; + apr_pool_t *parent; + + /* Top level pool scope, need process-scope lifetime */ + for ( ; parent = apr_pool_parent_get(pool); parent) + pool = parent; + +#ifdef WIN32 + path = "apr_ldap.dll"; +#elif defined(NETWARE) + path = "apr_ldap.nlm"; +#else + path = APU_DSO_LIBDIR "/apr_ldap.so"; +#endif + rv = apr_dso_load(&dlhandle, path, pool); + if (rv != APR_SUCCESS) { /* APR_EDSOOPEN */ + return rv; + } + rv = apr_dso_sym(&symbol, dlhandle, "apr__ldap_fns"); + if (rv != APR_SUCCESS) { /* APR_ESYMNOTFOUND */ + apr_dso_unload(dlhandle); + return rv; + } + lfn = symbol; + + return rv; +} + +#define LOAD_LDAP_STUB(pool, failres) \ + if (!lfn && (load_ldap(pool) != APR_SUCCESS)) \ + return failres; + +APU_DECLARE_LDAP(int) apr_ldap_info(apr_pool_t *pool, + apr_ldap_err_t **result_err) +{ + LOAD_LDAP_STUB(pool, -1); + return lfn->info(pool, result_err); +} + +APU_DECLARE_LDAP(int) apr_ldap_init(apr_pool_t *pool, + LDAP **ldap, + const char *hostname, + int portno, + int secure, + apr_ldap_err_t **result_err) +{ + LOAD_LDAP_STUB(pool, -1); + return lfn->init(pool, ldap, hostname, portno, secure, result_err); +} + +APU_DECLARE_LDAP(int) apr_ldap_ssl_init(apr_pool_t *pool, + const char *cert_auth_file, + int cert_file_type, + apr_ldap_err_t **result_err) +{ + LOAD_LDAP_STUB(pool, -1); + return lfn->ssl_init(pool, cert_auth_file, cert_file_type, result_err); +} + +APU_DECLARE_LDAP(int) apr_ldap_ssl_deinit(void) +{ + if (!lfn) + return -1; + return lfn->ssl_deinit(); +} + +APU_DECLARE_LDAP(int) apr_ldap_get_option(apr_pool_t *pool, + LDAP *ldap, + int option, + void *outvalue, + apr_ldap_err_t **result_err) +{ + LOAD_LDAP_STUB(pool, -1); + return lfn->get_option(pool, ldap, option, outvalue, result_err); +} + +APU_DECLARE_LDAP(int) apr_ldap_set_option(apr_pool_t *pool, + LDAP *ldap, + int option, + const void *invalue, + apr_ldap_err_t **result_err) +{ + LOAD_LDAP_STUB(pool, -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, APR_EGENERAL); + return lfn->rebind_init(pool); +} + +APU_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_add(apr_pool_t *pool, + LDAP *ld, + const char *bindDN, + const char *bindPW) +{ + LOAD_LDAP_STUB(pool, APR_EGENERAL); + return lfn->rebind_add(pool, ld, bindDN, bindPW); +} + +APU_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_remove(LDAP *ld) +{ + if (!lfn) + return APR_EGENERAL; + return lfn->rebind_remove(ld); +} + +#endif /* APU_DSO_BUILD */ + +#endif /* APR_HAS_LDAP */ + Property changes on: ldap/apr_ldap_stub.c ___________________________________________________________________ Name: svn:eol-style + native Index: ldap/apr_ldap_init.c =================================================================== --- ldap/apr_ldap_init.c (revision 657138) +++ ldap/apr_ldap_init.c (working copy) @@ -24,7 +24,14 @@ #include "apr.h" #include "apu.h" +#include "apu_config.h" + +#ifdef APU_DSO_BUILD +#define APU_DSO_LDAP_BUILD +#endif + #include "apr_ldap.h" +#include "apu_internal.h" #include "apr_errno.h" #include "apr_pools.h" #include "apr_strings.h" @@ -49,10 +56,11 @@ * will return APR_EGENERAL. Further LDAP specific error information * can be found in result_err. */ -APU_DECLARE(int) apr_ldap_ssl_init(apr_pool_t *pool, - const char *cert_auth_file, - int cert_file_type, - apr_ldap_err_t **result_err) { +APU_DECLARE_LDAP(int) apr_ldap_ssl_init(apr_pool_t *pool, + const char *cert_auth_file, + int cert_file_type, + apr_ldap_err_t **result_err) +{ apr_ldap_err_t *result = (apr_ldap_err_t *)apr_pcalloc(pool, sizeof(apr_ldap_err_t)); *result_err = result; @@ -105,7 +113,8 @@ * @todo currently we do not check whether apr_ldap_ssl_init() * has been called first - should we? */ -APU_DECLARE(int) apr_ldap_ssl_deinit(void) { +APU_DECLARE_LDAP(int) apr_ldap_ssl_deinit(void) +{ #if APR_HAS_LDAP_SSL && APR_HAS_LDAPSSL_CLIENT_DEINIT ldapssl_client_deinit(); @@ -135,12 +144,13 @@ * APR_LDAP_SSL: SSL encryption (ldaps://) * APR_LDAP_STARTTLS: Force STARTTLS on ldap:// */ -APU_DECLARE(int) apr_ldap_init(apr_pool_t *pool, - LDAP **ldap, - const char *hostname, - int portno, - int secure, - apr_ldap_err_t **result_err) { +APU_DECLARE_LDAP(int) apr_ldap_init(apr_pool_t *pool, + LDAP **ldap, + const char *hostname, + int portno, + int secure, + apr_ldap_err_t **result_err) +{ apr_ldap_err_t *result = (apr_ldap_err_t *)apr_pcalloc(pool, sizeof(apr_ldap_err_t)); *result_err = result; @@ -174,7 +184,8 @@ * This function returns a string describing the LDAP toolkit * currently in use. The string is placed inside result_err->reason. */ -APU_DECLARE(int) apr_ldap_info(apr_pool_t *pool, apr_ldap_err_t **result_err) +APU_DECLARE_LDAP(int) apr_ldap_info(apr_pool_t *pool, + apr_ldap_err_t **result_err) { apr_ldap_err_t *result = (apr_ldap_err_t *)apr_pcalloc(pool, sizeof(apr_ldap_err_t)); *result_err = result; @@ -186,4 +197,23 @@ } +#if APU_DSO_BUILD + +/* For DSO builds, export the table of entry points into the apr_ldap DSO + * See include/private/apu_internal.h for the corresponding declarations + */ +APU_DECLARE_DATA struct apr__ldap_dso_fntable apr__ldap_fns = { + apr_ldap_info, + apr_ldap_init, + apr_ldap_ssl_init, + apr_ldap_ssl_deinit, + apr_ldap_get_option, + apr_ldap_set_option, + apr_ldap_rebind_init, + apr_ldap_rebind_add, + apr_ldap_rebind_remove +}; + +#endif /* APU_DSO_BUILD */ + #endif /* APR_HAS_LDAP */ Index: ldap/apr_ldap_rebind.c =================================================================== --- ldap/apr_ldap_rebind.c (revision 657138) +++ ldap/apr_ldap_rebind.c (working copy) @@ -23,6 +23,12 @@ #include "apr.h" #include "apu.h" +#include "apu_config.h" + +#ifdef APU_DSO_BUILD +#define APU_DSO_LDAP_BUILD +#endif + #include "apr_ldap.h" #include "apr_errno.h" #include "apr_strings.h" @@ -59,7 +65,7 @@ static apr_status_t apr_ldap_rebind_remove_helper(void *data); /* APR utility routine used to create the xref_lock. */ -APU_DECLARE(apr_status_t) apr_ldap_rebind_init(apr_pool_t *pool) +APU_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_init(apr_pool_t *pool) { apr_status_t retcode = APR_SUCCESS; @@ -77,8 +83,10 @@ } -/*************************************************************************************/ -APU_DECLARE(apr_status_t) apr_ldap_rebind_add(apr_pool_t *pool, LDAP *ld, const char *bindDN, const char *bindPW) +APU_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_add(apr_pool_t *pool, + LDAP *ld, + const char *bindDN, + const char *bindPW) { apr_status_t retcode = APR_SUCCESS; apr_ldap_rebind_entry_t *new_xref; @@ -126,8 +134,8 @@ return(APR_SUCCESS); } -/*************************************************************************************/ -APU_DECLARE(apr_status_t) apr_ldap_rebind_remove(LDAP *ld) + +APU_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_remove(LDAP *ld) { apr_ldap_rebind_entry_t *tmp_xref, *prev = NULL; @@ -166,6 +174,7 @@ return APR_SUCCESS; } + static apr_status_t apr_ldap_rebind_remove_helper(void *data) { LDAP *ld = (LDAP *)data; @@ -173,7 +182,7 @@ return APR_SUCCESS; } -/*************************************************************************************/ + static apr_ldap_rebind_entry_t *apr_ldap_rebind_lookup(LDAP *ld) { apr_ldap_rebind_entry_t *tmp_xref, *match = NULL; Index: ldap/apr_ldap_option.c =================================================================== --- ldap/apr_ldap_option.c (revision 657138) +++ ldap/apr_ldap_option.c (working copy) @@ -23,6 +23,12 @@ #include "apr.h" #include "apu.h" +#include "apu_config.h" + +#ifdef APU_DSO_BUILD +#define APU_DSO_LDAP_BUILD +#endif + #include "apr_ldap.h" #include "apr_errno.h" #include "apr_pools.h" @@ -42,11 +48,11 @@ * This function gets option values from a given LDAP session if * one was specified. */ -APU_DECLARE(int) apr_ldap_get_option(apr_pool_t *pool, - LDAP *ldap, - int option, - void *outvalue, - apr_ldap_err_t **result_err) +APU_DECLARE_LDAP(int) apr_ldap_get_option(apr_pool_t *pool, + LDAP *ldap, + int option, + void *outvalue, + apr_ldap_err_t **result_err) { apr_ldap_err_t *result; Index: Makefile.in =================================================================== --- Makefile.in (revision 657138) +++ Makefile.in (working copy) @@ -35,6 +35,7 @@ LDADD_dbd_sqlite2 = @LDADD_dbd_sqlite2@ LDADD_dbd_sqlite3 = @LDADD_dbd_sqlite3@ LDADD_dbd_mysql = @LDADD_dbd_mysql@ +LDADD_ldap = @LDADD_ldap@ TARGETS = $(TARGET_LIB) aprutil.exp apu-config.out $(APU_MODULES) Index: include/apr_ldap_init.h =================================================================== --- include/apr_ldap_init.h (revision 657138) +++ include/apr_ldap_init.h (working copy) @@ -87,10 +87,10 @@ * apr_ldap_set_option() APR_LDAP_OPT_TLS_CERT option for details. * @param result_err The returned result */ -APU_DECLARE(int) apr_ldap_ssl_init(apr_pool_t *pool, - const char *cert_auth_file, - int cert_file_type, - apr_ldap_err_t **result_err); +APU_DECLARE_LDAP(int) apr_ldap_ssl_init(apr_pool_t *pool, + const char *cert_auth_file, + int cert_file_type, + apr_ldap_err_t **result_err); /** * APR LDAP SSL De-Initialise function @@ -101,7 +101,7 @@ * @todo currently we do not check whether apr_ldap_ssl_init() * has been called first - we probably should. */ -APU_DECLARE(int) apr_ldap_ssl_deinit(void); +APU_DECLARE_LDAP(int) apr_ldap_ssl_deinit(void); /** * APR LDAP initialise function @@ -137,12 +137,12 @@ * @param secure The security mode to set * @param result_err The returned result */ -APU_DECLARE(int) apr_ldap_init(apr_pool_t *pool, - LDAP **ldap, - const char *hostname, - int portno, - int secure, - apr_ldap_err_t **result_err); +APU_DECLARE_LDAP(int) apr_ldap_init(apr_pool_t *pool, + LDAP **ldap, + const char *hostname, + int portno, + int secure, + apr_ldap_err_t **result_err); /** * APR LDAP info function @@ -152,8 +152,8 @@ * @param pool The pool to use * @param result_err The returned result */ -APU_DECLARE(int) apr_ldap_info(apr_pool_t *pool, - apr_ldap_err_t **result_err); +APU_DECLARE_LDAP(int) apr_ldap_info(apr_pool_t *pool, + apr_ldap_err_t **result_err); #ifdef __cplusplus } Index: include/apr_ldap_rebind.h =================================================================== --- include/apr_ldap_rebind.h (revision 657138) +++ include/apr_ldap_rebind.h (working copy) @@ -39,7 +39,7 @@ * This function creates the lock for controlling access to the xref list.. * @param pool Pool to use when creating the xref_lock. */ -APU_DECLARE(apr_status_t) apr_ldap_rebind_init(apr_pool_t *pool); +APU_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_init(apr_pool_t *pool); /** @@ -63,10 +63,10 @@ * @param bindPW The bind Password to be used for any binds while * chasing referrals on this ldap connection. */ -APU_DECLARE(apr_status_t) apr_ldap_rebind_add(apr_pool_t *pool, - LDAP *ld, - const char *bindDN, - const char *bindPW); +APU_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_add(apr_pool_t *pool, + LDAP *ld, + const char *bindDN, + const char *bindPW); /** * APR LDAP rebind_remove function @@ -79,7 +79,7 @@ * * @param ld The LDAP connectionhandle */ -APU_DECLARE(apr_status_t) apr_ldap_rebind_remove(LDAP *ld); +APU_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_remove(LDAP *ld); #endif /* APR_HAS_LDAP */ Index: include/apr_ldap.h.in =================================================================== --- include/apr_ldap.h.in (revision 657138) +++ include/apr_ldap.h.in (working copy) @@ -153,6 +153,27 @@ #define APR_LDAP_IS_SERVER_DOWN(s) ((s) == LDAP_SERVER_DOWN) +/* These symbols are not actually exported in a DSO build, but mapped into + * a private exported function array for apr_ldap_stub to bind dynamically. + * Rename them appropriately to protect the global namespace. + */ +#ifdef APU_DSO_LDAP_BUILD + +#define apr_ldap_info apr__ldap_info +#define apr_ldap_init apr__ldap_init +#define apr_ldap_ssl_init apr__ldap_ssl_init +#define apr_ldap_ssl_deinit apr__ldap_ssl_deinit +#define apr_ldap_get_option apr__ldap_get_option +#define apr_ldap_set_option apr__ldap_set_option +#define apr_ldap_rebind_init apr__ldap_rebind_init +#define apr_ldap_rebind_add apr__ldap_rebind_add +#define apr_ldap_rebind_remove apr__ldap_rebind_remove + +#define APU_DECLARE_LDAP(type) type +#else +#define APU_DECLARE_LDAP(type) APU_DECLARE(type) +#endif + #include "apr_ldap_url.h" #include "apr_ldap_init.h" #include "apr_ldap_option.h" Index: include/apr_ldap.hw =================================================================== --- include/apr_ldap.hw (revision 657138) +++ include/apr_ldap.hw (working copy) @@ -134,9 +134,31 @@ #define APR_LDAP_IS_SERVER_DOWN(s) ((s) == LDAP_SERVER_DOWN) #endif +/* These symbols are not actually exported in a DSO build, but mapped into + * a private exported function array for apr_ldap_stub to bind dynamically. + * Rename them appropriately to protect the global namespace. + */ +#ifdef APU_DSO_LDAP_BUILD + +#define apr_ldap_info apr__ldap_info +#define apr_ldap_init apr__ldap_init +#define apr_ldap_ssl_init apr__ldap_ssl_init +#define apr_ldap_ssl_deinit apr__ldap_ssl_deinit +#define apr_ldap_get_option apr__ldap_get_option +#define apr_ldap_set_option apr__ldap_set_option +#define apr_ldap_rebind_init apr__ldap_rebind_init +#define apr_ldap_rebind_add apr__ldap_rebind_add +#define apr_ldap_rebind_remove apr__ldap_rebind_remove + +#define APU_DECLARE_LDAP(type) type +#else +#define APU_DECLARE_LDAP(type) APU_DECLARE(type) +#endif + #include "apr_ldap_url.h" #include "apr_ldap_init.h" #include "apr_ldap_option.h" +#include "apr_ldap_rebind.h" /** @} */ #endif /* APR_HAS_LDAP */ Index: include/apr_ldap_option.h =================================================================== --- include/apr_ldap_option.h (revision 657138) +++ include/apr_ldap_option.h (working copy) @@ -215,11 +215,11 @@ * @param result_err The apr_ldap_err_t structure contained detailed results * of the operation. */ -APU_DECLARE(int) apr_ldap_get_option(apr_pool_t *pool, - LDAP *ldap, - int option, - void *outvalue, - apr_ldap_err_t **result_err); +APU_DECLARE_LDAP(int) apr_ldap_get_option(apr_pool_t *pool, + LDAP *ldap, + int option, + void *outvalue, + apr_ldap_err_t **result_err); /** * APR LDAP set option function @@ -237,11 +237,11 @@ * @param result_err The apr_ldap_err_t structure contained detailed results * of the operation. */ -APU_DECLARE(int) apr_ldap_set_option(apr_pool_t *pool, - LDAP *ldap, - int option, - const void *invalue, - apr_ldap_err_t **result_err); +APU_DECLARE_LDAP(int) apr_ldap_set_option(apr_pool_t *pool, + LDAP *ldap, + int option, + const void *invalue, + apr_ldap_err_t **result_err); #ifdef __cplusplus } Index: include/private/apu_internal.h =================================================================== --- include/private/apu_internal.h (revision 0) +++ include/private/apu_internal.h (revision 0) @@ -0,0 +1,59 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "apr.h" +#include "apu.h" + +#ifndef APU_INTERNAL_H +#define APU_INTERNAL_H + +#if APR_HAS_LDAP + +#if APU_DSO_BUILD + +/* For LDAP internal builds, wrap our LDAP namespace */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct apr__ldap_dso_fntable { + int (*info)(apr_pool_t *pool, apr_ldap_err_t **result_err); + int (*init)(apr_pool_t *pool, LDAP **ldap, const char *hostname, + int portno, int secure, apr_ldap_err_t **result_err); + int (*ssl_init)(apr_pool_t *pool, const char *cert_auth_file, + int cert_file_type, apr_ldap_err_t **result_err); + int (*ssl_deinit)(void); + int (*get_option)(apr_pool_t *pool, LDAP *ldap, int option, + void *outvalue, apr_ldap_err_t **result_err); + int (*set_option)(apr_pool_t *pool, LDAP *ldap, int option, + const void *invalue, apr_ldap_err_t **result_err); + apr_status_t (*rebind_init)(apr_pool_t *pool); + apr_status_t (*rebind_add)(apr_pool_t *pool, LDAP *ld, + const char *bindDN, const char *bindPW); + apr_status_t (*rebind_remove)(LDAP *ld); +}; + +#ifdef __cplusplus +} +#endif + +#endif /* APU_DSO_BUILD */ + +#endif /* APR_HAS_LDAP */ + +#endif /* APU_INTERNAL_H */ + Property changes on: include/private/apu_internal.h ___________________________________________________________________ Name: svn:eol-style + native Index: include/apr_ldap.hnw =================================================================== --- include/apr_ldap.hnw (revision 657138) +++ include/apr_ldap.hnw (working copy) @@ -126,9 +126,31 @@ #define APR_LDAP_IS_SERVER_DOWN(s) ((s) == LDAP_SERVER_DOWN) +/* These symbols are not actually exported in a DSO build, but mapped into + * a private exported function array for apr_ldap_stub to bind dynamically. + * Rename them appropriately to protect the global namespace. + */ +#ifdef APU_DSO_LDAP_BUILD + +#define apr_ldap_info apr__ldap_info +#define apr_ldap_init apr__ldap_init +#define apr_ldap_ssl_init apr__ldap_ssl_init +#define apr_ldap_ssl_deinit apr__ldap_ssl_deinit +#define apr_ldap_get_option apr__ldap_get_option +#define apr_ldap_set_option apr__ldap_set_option +#define apr_ldap_rebind_init apr__ldap_rebind_init +#define apr_ldap_rebind_add apr__ldap_rebind_add +#define apr_ldap_rebind_remove apr__ldap_rebind_remove + +#define APU_DECLARE_LDAP(type) type +#else +#define APU_DECLARE_LDAP(type) APU_DECLARE(type) +#endif + #include "apr_ldap_url.h" #include "apr_ldap_init.h" #include "apr_ldap_option.h" +#include "apr_ldap_rebind.h" /** @} */ #endif /* APR_HAS_LDAP */ Index: build.conf =================================================================== --- build.conf (revision 657138) +++ build.conf (working copy) @@ -12,7 +12,8 @@ dbm/sdbm/*.c encoding/*.c hooks/*.c - ldap/*.c + ldap/apr_ldap_stub.c + ldap/apr_ldap_url.c misc/*.c memcache/*.c uri/apr_uri.c @@ -28,7 +29,7 @@ # the public headers headers = include/*.h include/private/*.h -modules = dbd_pgsql dbd_sqlite2 dbd_sqlite3 dbd_oracle dbd_mysql dbd_freetds +modules = ldap dbd_pgsql dbd_sqlite2 dbd_sqlite3 dbd_oracle dbd_mysql dbd_freetds # gen_uri_delim.c @@ -59,3 +60,8 @@ paths = dbd/apr_dbd_freetds.c target = dbd/apr_dbd_freetds.la +[ldap] +paths = ldap/apr_ldap_init.c \ + ldap/apr_ldap_option.c \ + ldap/apr_ldap_rebind.c +target = ldap/apr_ldap.la Index: configure.in =================================================================== --- configure.in (revision 657138) +++ configure.in (working copy) @@ -154,11 +154,12 @@ APU_CHECK_DBD_SQLITE2 APU_CHECK_DBD_ORACLE APU_CHECK_DBD_FREETDS -dnl Enable DSO build; must be last: -APU_CHECK_DBD_DSO APU_FIND_EXPAT APU_FIND_ICONV +dnl Enable DSO build; must be last: +APU_CHECK_DBD_DSO + AC_SEARCH_LIBS(crypt, crypt ufc) AC_MSG_CHECKING(if system crypt() function is threadsafe) if test "x$apu_crypt_threadsafe" = "x1"; then Index: dbd/apr_dbd.c =================================================================== --- dbd/apr_dbd.c (revision 657138) +++ dbd/apr_dbd.c (working copy) @@ -129,7 +129,7 @@ const apr_dbd_driver_t **driver) { #ifdef APU_DSO_BUILD - char path[80]; + char *path; apr_dso_handle_t *dlhandle = NULL; apr_dso_handle_sym_t symbol; #endif @@ -152,17 +152,17 @@ pool = apr_hash_pool_get(drivers); #ifdef WIN32 - apr_snprintf(path, sizeof path, "apr_dbd_%s.dll", name); + path = apr_psprintf(pool, "apr_dbd_%s.dll", name); #elif defined(NETWARE) - apr_snprintf(path, sizeof path, "dbd%s.nlm", name); + path = apr_psprintf(pool, "dbd%s.nlm", name); #else - apr_snprintf(path, sizeof path, "%s/apr_dbd_%s.so", APU_DSO_LIBDIR, name); + path = apr_psprintf(pool, "%s/apr_dbd_%s.so", APU_DSO_LIBDIR, name); #endif rv = apr_dso_load(&dlhandle, path, pool); if (rv != APR_SUCCESS) { /* APR_EDSOOPEN */ goto unlock; } - apr_snprintf(path, sizeof path, "apr_dbd_%s_driver", name); + path = apr_psprintf(pool, "apr_dbd_%s_driver", name); rv = apr_dso_sym(&symbol, dlhandle, path); if (rv != APR_SUCCESS) { /* APR_ESYMNOTFOUND */ apr_dso_unload(dlhandle); @@ -183,6 +183,7 @@ return rv; } + APU_DECLARE(apr_status_t) apr_dbd_open_ex(const apr_dbd_driver_t *driver, apr_pool_t *pool, const char *params, apr_dbd_t **handle, Index: apu-config.in =================================================================== --- apu-config.in (revision 657138) +++ apu-config.in (working copy) @@ -30,6 +30,7 @@ LIBS="@APRUTIL_EXPORT_LIBS@" INCLUDES="@APRUTIL_INCLUDES@" LDFLAGS="@APRUTIL_LDFLAGS@" +LDAP_LIBS="@LDADD_ldap@" APRUTIL_LIBNAME="@APRUTIL_LIBNAME@" @@ -53,6 +54,7 @@ --includedir print location where headers are installed --ldflags print linker flags --libs print library information + --ldap-libs print additional library information to link with ldap --srcdir print APR-util source directory --link-ld print link switch(es) for linking to APR-util --link-libtool print the libtool inputs for linking to APR-util @@ -112,6 +114,9 @@ --libs) flags="$flags $LIBS" ;; + --ldap-libs) + flags="$flags $LDAP_LIBS" + ;; --includedir) if test "$location" = "installed"; then flags="$includedir" Index: build/apu-conf.m4 =================================================================== --- build/apu-conf.m4 (revision 657138) +++ build/apu-conf.m4 (working copy) @@ -191,8 +191,7 @@ unset ac_cv_lib_${ldaplib}___ldap_init AC_CHECK_LIB(${ldaplib}, ldap_init, [ - APR_ADDTO(APRUTIL_EXPORT_LIBS,[-l${ldaplib} ${extralib}]) - APR_ADDTO(APRUTIL_LIBS,[-l${ldaplib} ${extralib}]) + LDADD_ldap="-l${ldaplib} ${extralib}" AC_CHECK_LIB(${ldaplib}, ldapssl_client_init, apu_has_ldapssl_client_init="1", , ${extralib}) AC_CHECK_LIB(${ldaplib}, ldapssl_client_deinit, apu_has_ldapssl_client_deinit="1", , ${extralib}) AC_CHECK_LIB(${ldaplib}, ldapssl_add_trusted_cert, apu_has_ldapssl_add_trusted_cert="1", , ${extralib}) @@ -230,6 +229,7 @@ apu_has_ldap_tivoli="0" apu_has_ldap_zos="0" apu_has_ldap_other="0" +LDADD_ldap="" AC_ARG_WITH(ldap-include,[ --with-ldap-include=path path to ldap include files with trailing slash]) AC_ARG_WITH(ldap-lib,[ --with-ldap-lib=path path to ldap lib file]) @@ -376,6 +376,7 @@ AC_SUBST(apu_has_ldap_tivoli) AC_SUBST(apu_has_ldap_zos) AC_SUBST(apu_has_ldap_other) +AC_SUBST(LDADD_ldap) ]) Index: build/dbd.m4 =================================================================== --- build/dbd.m4 (revision 657138) +++ build/dbd.m4 (working copy) @@ -383,6 +383,9 @@ test $apu_have_sqlite2 = 1 && objs="$objs dbd/apr_dbd_sqlite2.lo" test $apu_have_sqlite3 = 1 && objs="$objs dbd/apr_dbd_sqlite3.lo" test $apu_have_freetds = 1 && objs="$objs dbd/apr_dbd_freetds.lo" + test $apu_has_ldap = 1 && objs="$objs ldap/apr_ldap_init.lo" + test $apu_has_ldap = 1 && objs="$objs ldap/apr_ldap_option.lo" + test $apu_has_ldap = 1 && objs="$objs ldap/apr_ldap_rebind.lo" EXTRA_OBJECTS="$EXTRA_OBJECTS $objs" # Use libtool *.la for mysql if available @@ -399,8 +402,8 @@ done fi - APRUTIL_LIBS="$APRUTIL_LIBS $LDADD_dbd_pgsql $LDADD_dbd_sqlite2 $LDADD_dbd_sqlite3 $LDADD_dbd_oracle $LDADD_dbd_mysql $LDADD_dbd_freetds" - APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LDADD_dbd_pgsql $LDADD_dbd_sqlite2 $LDADD_dbd_sqlite3 $LDADD_dbd_oracle $LDADD_dbd_mysql $LDADD_dbd_freetds" + APRUTIL_LIBS="$APRUTIL_LIBS $LDADD_dbd_pgsql $LDADD_dbd_sqlite2 $LDADD_dbd_sqlite3 $LDADD_dbd_oracle $LDADD_dbd_mysql $LDADD_dbd_freetds $LDADD_ldap" + APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LDADD_dbd_pgsql $LDADD_dbd_sqlite2 $LDADD_dbd_sqlite3 $LDADD_dbd_oracle $LDADD_dbd_mysql $LDADD_dbd_freetds $LDADD_ldap" else AC_DEFINE([APU_DSO_BUILD], 1, [Define if DBD drivers are built as DSOs]) @@ -411,6 +414,7 @@ test $apu_have_sqlite2 = 1 && dsos="$dsos dbd/apr_dbd_sqlite2.la" test $apu_have_sqlite3 = 1 && dsos="$dsos dbd/apr_dbd_sqlite3.la" test $apu_have_freetds = 1 && dsos="$dsos dbd/apr_dbd_freetds.la" + test $apu_has_ldap = 1 && dsos="$dsos ldap/apr_ldap.la" APU_MODULES="$APU_MODULES $dsos" fi