From 0a7d8b69dd2034aeefadf1e241be0a0523a1eac6 Mon Sep 17 00:00:00 2001 From: Bradley Nicholes Date: Sun, 15 Jan 2006 00:26:20 +0000 Subject: [PATCH] eliminate the import of the ap_satisfies optional function on every request. Just import it once if it exists. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@369124 13f79535-47bb-0310-9956-ffa450edef68 --- modules/aaa/mod_authz_core.c | 8 ++++++-- modules/aaa/mod_authz_default.c | 17 ++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/modules/aaa/mod_authz_core.c b/modules/aaa/mod_authz_core.c index ce303ba597..57ff7c2163 100644 --- a/modules/aaa/mod_authz_core.c +++ b/modules/aaa/mod_authz_core.c @@ -592,8 +592,6 @@ static int authorize_user(request_rec *r) authz_provider_list *current_provider; const char *note = apr_table_get(r->notes, AUTHZ_ACCESS_PASSED_NOTE); - ap_satisfies = APR_RETRIEVE_OPTIONAL_FN(ap_satisfies); - /* If we're not really configured for providers, stop now. */ if (!conf->providers) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, @@ -667,11 +665,17 @@ static int authz_some_auth_required(request_rec *r) return req_authz; } +static void ImportAuthzCoreOptFn(void) +{ + ap_satisfies = APR_RETRIEVE_OPTIONAL_FN(ap_satisfies); +} + static void register_hooks(apr_pool_t *p) { APR_REGISTER_OPTIONAL_FN(authz_some_auth_required); ap_hook_auth_checker(authorize_user, NULL, NULL, APR_HOOK_MIDDLE); + ap_hook_optional_fn_retrieve(ImportAuthzCoreOptFn,NULL,NULL,APR_HOOK_MIDDLE); } module AP_MODULE_DECLARE_DATA authz_core_module = diff --git a/modules/aaa/mod_authz_default.c b/modules/aaa/mod_authz_default.c index 4d06c5341b..515f478780 100644 --- a/modules/aaa/mod_authz_default.c +++ b/modules/aaa/mod_authz_default.c @@ -60,12 +60,13 @@ static int check_user_access(request_rec *r) &authz_default_module); const char *note = apr_table_get(r->notes, AUTHZ_ACCESS_PASSED_NOTE); - ap_satisfies = APR_RETRIEVE_OPTIONAL_FN(ap_satisfies); + /* If we got here and access checker passed, assume access is OK */ + if (note && (note[0] == 'Y') && (ap_satisfies(r) == SATISFY_ANY)) { + return OK; + } - /* If we got here and there isn't any authz required and there is no - note from the access checker that it failed, assume access is OK */ - if (!ap_some_auth_required(r) || - (note && (note[0] == 'Y') && (ap_satisfies(r) == SATISFY_ANY))) { + /* If we got here and there isn't any authz required, assume access is OK */ + if (!ap_some_auth_required(r)) { return OK; } @@ -88,9 +89,15 @@ static int check_user_access(request_rec *r) return HTTP_UNAUTHORIZED; } +static void ImportAuthzDefOptFn(void) +{ + ap_satisfies = APR_RETRIEVE_OPTIONAL_FN(ap_satisfies); +} + static void register_hooks(apr_pool_t *p) { ap_hook_auth_checker(check_user_access,NULL,NULL,APR_HOOK_LAST); + ap_hook_optional_fn_retrieve(ImportAuthzDefOptFn,NULL,NULL,APR_HOOK_MIDDLE); } module AP_MODULE_DECLARE_DATA authz_default_module = -- 2.40.0