]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
eliminate the import of the ap_satisfies optional function on every request. Just...
authorBradley Nicholes <bnicholes@apache.org>
Sun, 15 Jan 2006 00:26:20 +0000 (00:26 +0000)
committerBradley Nicholes <bnicholes@apache.org>
Sun, 15 Jan 2006 00:26:20 +0000 (00:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@369124 13f79535-47bb-0310-9956-ffa450edef68

modules/aaa/mod_authz_core.c
modules/aaa/mod_authz_default.c

index ce303ba59747125692274ba69340c380ecae98ad..57ff7c21638012f42db7460fca76233abb8a6dfb 100644 (file)
@@ -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 =
index 4d06c5341b3acdbfba44b2414feda93cdb25e7a0..515f478780bab3ec4a95b4f7e38bbb9eccc9cceb 100644 (file)
@@ -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 =