Commit ce567e80 authored by Bradley Nicholes's avatar Bradley Nicholes
Browse files

eliminate the import of the ap_satisfies optional function on every request. ...

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
parent 677e2ad1
Loading
Loading
Loading
Loading
+6 −2
Changes for modules/aaa/mod_authz_core.c: 6 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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 =
+12 −5
Changes for modules/aaa/mod_authz_default.c: 12 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -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 =