Commit c6b10a6b authored by Joe Orton's avatar Joe Orton
Browse files

Fix load order dependencies in LDAP code by switching to use of APR

optional functions for the inter-module API:

* modules/ldap/ldap_private.h: New file, containing "real" function
  declarations, copied from...

* include/ap_ldap.h.in, include/ap_ldap_url.h,
  include/ap_ldap_option.h, include/ap_ldap_init.h,
  include/ap_ldap_rebind.h: ... here.  All declarations changed to APR
  optional function declarations.

* modules/ldap/util_ldap.c (util_ldap_register_hooks): Register all
  the new optional functions.

* modules/aaa/mod_authnz_ldap.c (ImportULDAPOptFn): Pick up optional
  function stub for ap_ldap_url_parse.
  (mod_auth_ldap_parse_url): Use it here.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1140069 13f79535-47bb-0310-9956-ffa450edef68
parent d513a967
Loading
Loading
Loading
Loading
+1 −20
Original line number Diff line number Diff line
@@ -30,26 +30,7 @@
 * @{
 */

/* Create a set of LDAP_DECLARE macros with appropriate export 
 * and import tags for the platform
 */
#if !defined(WIN32)
#define LDAP_DECLARE(type)            type
#define LDAP_DECLARE_NONSTD(type)     type
#define LDAP_DECLARE_DATA
#elif defined(LDAP_DECLARE_STATIC)
#define LDAP_DECLARE(type)            type __stdcall
#define LDAP_DECLARE_NONSTD(type)     type
#define LDAP_DECLARE_DATA
#elif defined(LDAP_DECLARE_EXPORT)
#define LDAP_DECLARE(type)            __declspec(dllexport) type __stdcall
#define LDAP_DECLARE_NONSTD(type)     __declspec(dllexport) type
#define LDAP_DECLARE_DATA             __declspec(dllexport)
#else
#define LDAP_DECLARE(type)            __declspec(dllimport) type __stdcall
#define LDAP_DECLARE_NONSTD(type)     __declspec(dllimport) type
#define LDAP_DECLARE_DATA             __declspec(dllimport)
#endif
#include "apr_optional.h"

/* identify the LDAP toolkit used */
#define AP_HAS_NETSCAPE_LDAPSDK  @ap_has_ldap_netscape@
+1 −20
Original line number Diff line number Diff line
@@ -30,26 +30,7 @@
 * @{
 */

/* Create a set of LDAP_DECLARE macros with appropriate export 
 * and import tags for the platform
 */
#if !defined(WIN32)
#define LDAP_DECLARE(type)            type
#define LDAP_DECLARE_NONSTD(type)     type
#define LDAP_DECLARE_DATA
#elif defined(LDAP_DECLARE_STATIC)
#define LDAP_DECLARE(type)            type __stdcall
#define LDAP_DECLARE_NONSTD(type)     type
#define LDAP_DECLARE_DATA
#elif defined(LDAP_DECLARE_EXPORT)
#define LDAP_DECLARE(type)            __declspec(dllexport) type __stdcall
#define LDAP_DECLARE_NONSTD(type)     __declspec(dllexport) type
#define LDAP_DECLARE_DATA             __declspec(dllexport)
#else
#define LDAP_DECLARE(type)            __declspec(dllimport) type __stdcall
#define LDAP_DECLARE_NONSTD(type)     __declspec(dllimport) type
#define LDAP_DECLARE_DATA             __declspec(dllimport)
#endif
#include "apr_optional.h"

/* this will be defined if LDAP support was compiled into apr-util */
#define AP_HAS_LDAP		   1
+15 −13
Original line number Diff line number Diff line
@@ -86,10 +86,12 @@ extern "C" {
 * ap_ldap_set_option() AP_LDAP_OPT_TLS_CERT option for details.
 * @param result_err The returned result
 */
LDAP_DECLARE(int) ap_ldap_ssl_init(apr_pool_t *pool,
APR_DECLARE_OPTIONAL_FN(int, ap_ldap_ssl_init, 
                        (apr_pool_t *pool,
                         const char *cert_auth_file,
                         int cert_file_type,
                                      ap_ldap_err_t **result_err);
                         ap_ldap_err_t **result_err));


/**
 * LDAP SSL De-Initialise function
@@ -100,7 +102,7 @@ LDAP_DECLARE(int) ap_ldap_ssl_init(apr_pool_t *pool,
 * @todo currently we do not check whether ap_ldap_ssl_init()
 * has been called first - we probably should.
 */
LDAP_DECLARE(int) ap_ldap_ssl_deinit(void);
APR_DECLARE_OPTIONAL_FN(int, ap_ldap_ssl_deinit, (void));

/**
 * LDAP initialise function
@@ -136,12 +138,12 @@ LDAP_DECLARE(int) ap_ldap_ssl_deinit(void);
 * @param secure The security mode to set
 * @param result_err The returned result
 */
LDAP_DECLARE(int) ap_ldap_init(apr_pool_t *pool,
APR_DECLARE_OPTIONAL_FN(int, ap_ldap_init, (apr_pool_t *pool, 
                                            LDAP **ldap,
                                            const char *hostname,
                                            int portno,
                                            int secure,
                                  ap_ldap_err_t **result_err);
                                            ap_ldap_err_t **result_err));

/**
 * LDAP info function
@@ -151,8 +153,8 @@ LDAP_DECLARE(int) ap_ldap_init(apr_pool_t *pool,
 * @param pool The pool to use
 * @param result_err The returned result
 */
LDAP_DECLARE(int) ap_ldap_info(apr_pool_t *pool,
                                  ap_ldap_err_t **result_err);
APR_DECLARE_OPTIONAL_FN(int, ap_ldap_info, (apr_pool_t *pool,
                                            ap_ldap_err_t **result_err));

#ifdef __cplusplus
}
+10 −10
Original line number Diff line number Diff line
@@ -214,11 +214,11 @@ struct ap_ldap_opt_tls_cert_t {
 * @param result_err The ap_ldap_err_t structure contained detailed results
 *        of the operation.
 */
LDAP_DECLARE(int) ap_ldap_get_option(apr_pool_t *pool,
APR_DECLARE_OPTIONAL_FN(int, ap_ldap_get_option, (apr_pool_t *pool,
                                                  LDAP *ldap,
                                                  int option,
                                                  void *outvalue,
                                        ap_ldap_err_t **result_err);
                                                  ap_ldap_err_t **result_err));

/**
 * LDAP set option function
@@ -236,11 +236,11 @@ LDAP_DECLARE(int) ap_ldap_get_option(apr_pool_t *pool,
 * @param result_err The ap_ldap_err_t structure contained detailed results
 *        of the operation.
 */
LDAP_DECLARE(int) ap_ldap_set_option(apr_pool_t *pool,
APR_DECLARE_OPTIONAL_FN(int, ap_ldap_set_option, (apr_pool_t *pool,
                                                  LDAP *ldap,
                                                  int option,
                                                  const void *invalue,
                                        ap_ldap_err_t **result_err);
                                                  ap_ldap_err_t **result_err));

#ifdef __cplusplus
}
+6 −6
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@
 * This function creates the lock for controlling access to the xref list..
 * @param pool Pool to use when creating the xref_lock.
 */
LDAP_DECLARE(apr_status_t) ap_ldap_rebind_init(apr_pool_t *pool);
APR_DECLARE_OPTIONAL_FN(apr_status_t, ap_ldap_rebind_init, (apr_pool_t *pool));


/**
@@ -72,10 +72,10 @@ LDAP_DECLARE(apr_status_t) ap_ldap_rebind_init(apr_pool_t *pool);
 * @param bindPW The bind Password to be used for any binds while 
 *               chasing referrals on this ldap connection.
 */
LDAP_DECLARE(apr_status_t) ap_ldap_rebind_add(apr_pool_t *pool,
APR_DECLARE_OPTIONAL_FN(apr_status_t, ap_ldap_rebind_add, (apr_pool_t *pool,
                                                           LDAP *ld,
                                                           const char *bindDN,
                                                 const char *bindPW);
                                                           const char *bindPW));

/**
 * LDAP rebind_remove function
@@ -88,7 +88,7 @@ LDAP_DECLARE(apr_status_t) ap_ldap_rebind_add(apr_pool_t *pool,
 *
 * @param ld The LDAP connectionhandle
 */
LDAP_DECLARE(apr_status_t) ap_ldap_rebind_remove(LDAP *ld);
APR_DECLARE_OPTIONAL_FN(apr_status_t, ap_ldap_rebind_remove, (LDAP *ld));

#endif /* AP_HAS_LDAP */

Loading