From: Chris Darroch Date: Thu, 22 May 2008 17:01:14 +0000 (+0000) Subject: Determine registered authn/z providers directly in ap_setup_auth_internal(), X-Git-Tag: 2.3.0~593 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fc21f4e72eaa0da0ade4c76c929ac4e2776dde29;p=apache Determine registered authn/z providers directly in ap_setup_auth_internal(), which allows optional functions that just wrapped ap_list_provider_names() to be removed from authn/z modules. This change requires modules/aaa/mod_auth.h to be included into server/request.c, which necessitates a minor change to configure.in for Unix platforms. I'm unable to tell whether a similar change is necessary for Windows and NetWare builds or not. Could developers with access to those platforms please test and make any needed configuration or build alterations? Thanks! git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@659160 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 25f4a77559..2b6c48989d 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,11 @@ Changes with Apache 2.3.0 [ When backported to 2.2.x, remove entry from this file ] + *) core, authn/z: Determine registered authn/z providers directly in + ap_setup_auth_internal(), which allows optional functions that just + wrapped ap_list_provider_names() to be removed from authn/z modules. + [Chris Darroch] + *) authn/z: Convert common provider version strings to macros. [Chris Darroch] diff --git a/configure.in b/configure.in index 06b06d304f..a4d82e9d4f 100644 --- a/configure.in +++ b/configure.in @@ -204,7 +204,7 @@ if test "$abs_builddir" != "$abs_srcdir"; then APR_ADDTO(INCLUDES, [-I\$(top_builddir)/include]) fi -APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/os/\$(OS_DIR) -I\$(top_srcdir)/server/mpm/\$(MPM_SUBDIR_NAME) -I\$(top_srcdir)/modules/http -I\$(top_srcdir)/modules/filters -I\$(top_srcdir)/modules/proxy -I\$(top_srcdir)/modules/session -I\$(top_srcdir)/include -I\$(top_srcdir)/modules/generators -I\$(top_srcdir)/modules/mappers -I\$(top_srcdir)/modules/database]) +APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/os/\$(OS_DIR) -I\$(top_srcdir)/server/mpm/\$(MPM_SUBDIR_NAME) -I\$(top_srcdir)/modules/http -I\$(top_srcdir)/modules/aaa -I\$(top_srcdir)/modules/filters -I\$(top_srcdir)/modules/proxy -I\$(top_srcdir)/modules/session -I\$(top_srcdir)/include -I\$(top_srcdir)/modules/generators -I\$(top_srcdir)/modules/mappers -I\$(top_srcdir)/modules/database]) # apr/apr-util --includes may pick up system paths for dependent # libraries, so ensure these are later in INCLUDES than local source diff --git a/modules/aaa/mod_auth_basic.c b/modules/aaa/mod_auth_basic.c index 796e29a73c..e641119507 100644 --- a/modules/aaa/mod_auth_basic.c +++ b/modules/aaa/mod_auth_basic.c @@ -286,16 +286,8 @@ static int authenticate_basic_user(request_rec *r) return OK; } -static apr_array_header_t *authn_ap_list_provider_names(apr_pool_t *ptemp) -{ - return ap_list_provider_names(ptemp, AUTHN_PROVIDER_GROUP, - AUTHN_PROVIDER_VERSION); -} - static void register_hooks(apr_pool_t *p) { - APR_REGISTER_OPTIONAL_FN(authn_ap_list_provider_names); - ap_hook_check_authn(authenticate_basic_user, NULL, NULL, APR_HOOK_MIDDLE, AP_AUTH_INTERNAL_PER_CONF); } diff --git a/modules/aaa/mod_auth_digest.c b/modules/aaa/mod_auth_digest.c index 8760590cd1..6dfbea615f 100644 --- a/modules/aaa/mod_auth_digest.c +++ b/modules/aaa/mod_auth_digest.c @@ -1963,19 +1963,11 @@ static int add_auth_info(request_rec *r) return OK; } -static apr_array_header_t *authn_ap_list_provider_names(apr_pool_t *ptemp) -{ - return ap_list_provider_names(ptemp, AUTHN_PROVIDER_GROUP, - AUTHN_PROVIDER_VERSION); -} - static void register_hooks(apr_pool_t *p) { static const char * const cfgPost[]={ "http_core.c", NULL }; static const char * const parsePre[]={ "mod_proxy.c", NULL }; - APR_REGISTER_OPTIONAL_FN(authn_ap_list_provider_names); - ap_hook_post_config(initialize_module, NULL, cfgPost, APR_HOOK_MIDDLE); ap_hook_child_init(initialize_child, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_post_read_request(parse_hdr_and_update_nc, parsePre, NULL, APR_HOOK_MIDDLE); diff --git a/modules/aaa/mod_authn_core.c b/modules/aaa/mod_authn_core.c index bbe688161a..649f6c6f08 100644 --- a/modules/aaa/mod_authn_core.c +++ b/modules/aaa/mod_authn_core.c @@ -299,12 +299,6 @@ static const char *authn_ap_auth_name(request_rec *r) return apr_pstrdup(r->pool, conf->ap_auth_name); } -static apr_array_header_t *authn_ap_list_provider_names(apr_pool_t *ptemp) -{ - return ap_list_provider_names(ptemp, AUTHN_PROVIDER_GROUP, - AUTHN_PROVIDER_VERSION); -} - static const command_rec authn_cmds[] = { AP_INIT_TAKE1("AuthType", ap_set_string_slot, @@ -322,7 +316,6 @@ static void register_hooks(apr_pool_t *p) { APR_REGISTER_OPTIONAL_FN(authn_ap_auth_type); APR_REGISTER_OPTIONAL_FN(authn_ap_auth_name); - APR_REGISTER_OPTIONAL_FN(authn_ap_list_provider_names); } module AP_MODULE_DECLARE_DATA authn_core_module = diff --git a/modules/aaa/mod_authz_core.c b/modules/aaa/mod_authz_core.c index e1f7904888..6ba2c4aad4 100644 --- a/modules/aaa/mod_authz_core.c +++ b/modules/aaa/mod_authz_core.c @@ -805,16 +805,9 @@ static int authz_some_auth_required(request_rec *r) return req_authz; } -static apr_array_header_t *authz_ap_list_provider_names(apr_pool_t *ptemp) -{ - return ap_list_provider_names(ptemp, AUTHZ_PROVIDER_GROUP, - AUTHZ_PROVIDER_VERSION); -} - static void register_hooks(apr_pool_t *p) { APR_REGISTER_OPTIONAL_FN(authz_some_auth_required); - APR_REGISTER_OPTIONAL_FN(authz_ap_list_provider_names); ap_hook_check_authz(authorize_user, NULL, NULL, APR_HOOK_MIDDLE, AP_AUTH_INTERNAL_PER_CONF); diff --git a/server/request.c b/server/request.c index 159d8a04af..75b7930551 100644 --- a/server/request.c +++ b/server/request.c @@ -48,6 +48,7 @@ #include "mod_request.h" #include "mod_core.h" +#include "mod_auth.h" #if APR_HAVE_STDARG_H #include @@ -1685,10 +1686,6 @@ AP_DECLARE(void) ap_clear_auth_internal(void) AP_DECLARE(void) ap_setup_auth_internal(apr_pool_t *ptemp) { - APR_OPTIONAL_FN_TYPE(authn_ap_list_provider_names) - *authn_ap_list_provider_names; - APR_OPTIONAL_FN_TYPE(authz_ap_list_provider_names) - *authz_ap_list_provider_names; int total_auth_hooks = 0; int total_auth_providers = 0; @@ -1708,18 +1705,12 @@ AP_DECLARE(void) ap_setup_auth_internal(apr_pool_t *ptemp) return; } - authn_ap_list_provider_names = - APR_RETRIEVE_OPTIONAL_FN(authn_ap_list_provider_names); - authz_ap_list_provider_names = - APR_RETRIEVE_OPTIONAL_FN(authz_ap_list_provider_names); - - if (authn_ap_list_provider_names) { - total_auth_providers += authn_ap_list_provider_names(ptemp)->nelts; - } - - if (authz_ap_list_provider_names) { - total_auth_providers += authz_ap_list_provider_names(ptemp)->nelts; - } + total_auth_providers += + ap_list_provider_names(ptemp, AUTHN_PROVIDER_GROUP, + AUTHN_PROVIDER_VERSION)->nelts; + total_auth_providers += + ap_list_provider_names(ptemp, AUTHZ_PROVIDER_GROUP, + AUTHZ_PROVIDER_VERSION)->nelts; if (total_auth_providers > auth_internal_per_conf_providers) { return;