From: Bradley Nicholes Date: Fri, 2 Dec 2005 01:19:07 +0000 (+0000) Subject: Reimplement ap_some_auth_required as an optional function since the data has moved... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e7c9f4aa376258c98701305426c63ada0d3199e;p=thirdparty%2Fapache%2Fhttpd.git Reimplement ap_some_auth_required as an optional function since the data has moved to mod_authz_host yet it is still needed by the request handler git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/authz-dev@351547 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/http_core.h b/include/http_core.h index 60d0d0312c2..874974f25cb 100644 --- a/include/http_core.h +++ b/include/http_core.h @@ -687,6 +687,7 @@ APR_DECLARE_OPTIONAL_FN(const char *, ap_ident_lookup, APR_DECLARE_OPTIONAL_FN(const apr_array_header_t *, authz_host_ap_requires, (request_rec *r)); +APR_DECLARE_OPTIONAL_FN(int, authz_some_auth_required, (request_rec *r)); /* APR_DECLARE_OPTIONAL_FN(const char *, authz_host_ap_auth_type, (request_rec *r)); APR_DECLARE_OPTIONAL_FN(const char *, authz_host_ap_auth_name, (request_rec *r)); diff --git a/modules/aaa/mod_authz_host.c b/modules/aaa/mod_authz_host.c index 71bd59600f6..09e4447aab7 100644 --- a/modules/aaa/mod_authz_host.c +++ b/modules/aaa/mod_authz_host.c @@ -520,6 +520,46 @@ static const apr_array_header_t *authz_host_ap_requires(request_rec *r) return conf->ap_requires; } +static int authz_some_auth_required(request_rec *r) +{ + authz_host_dir_conf *conf = ap_get_module_config(r->per_dir_config, + &authz_host_module); + authz_provider_list *current_provider; + int req_authz = 1; + + current_provider = conf->providers; + do { + const authz_provider *provider; + + /* For now, if a provider isn't set, we'll be nice and use the file + * provider. + */ + if (!current_provider) { + provider = ap_lookup_provider(AUTHZ_PROVIDER_GROUP, + AUTHZ_DEFAULT_PROVIDER, "0"); + + if (!provider || !provider->check_authorization) { + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "No Authz providers configured. Assmuming no authorization required."); + req_authz = 0; + break; + } + } + else { + provider = current_provider->provider; + } + + if (current_provider->method_mask & (AP_METHOD_BIT << r->method_number)) { + req_authz = 1; + break; + } + + current_provider = current_provider->next; + } while (current_provider); + + return req_authz; +} + /* static const char *authz_host_ap_auth_type(request_rec *r) { @@ -545,6 +585,7 @@ static const char *authz_host_ap_auth_name(request_rec *r) static void register_hooks(apr_pool_t *p) { APR_REGISTER_OPTIONAL_FN(authz_host_ap_requires); + APR_REGISTER_OPTIONAL_FN(authz_some_auth_required); /* APR_REGISTER_OPTIONAL_FN(authz_host_ap_auth_type); APR_REGISTER_OPTIONAL_FN(authz_host_ap_auth_name); diff --git a/server/core.c b/server/core.c index 57a03fedbee..8af4c048381 100644 --- a/server/core.c +++ b/server/core.c @@ -3721,12 +3721,14 @@ static int default_handler(request_rec *r) * traffic */ APR_OPTIONAL_FN_TYPE(ap_logio_add_bytes_out) *logio_add_bytes_out; +APR_OPTIONAL_FN_TYPE(authz_some_auth_required) *azh_ap_some_auth_required; static int core_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) { logio_add_bytes_out = APR_RETRIEVE_OPTIONAL_FN(ap_logio_add_bytes_out); ident_lookup = APR_RETRIEVE_OPTIONAL_FN(ap_ident_lookup); azh_ap_requires = APR_RETRIEVE_OPTIONAL_FN(authz_host_ap_requires); + azh_ap_some_auth_required = APR_RETRIEVE_OPTIONAL_FN(authz_some_auth_required); /* azh_ap_auth_type = APR_RETRIEVE_OPTIONAL_FN(authz_host_ap_auth_type); azh_ap_auth_name = APR_RETRIEVE_OPTIONAL_FN(authz_host_ap_auth_name); diff --git a/server/request.c b/server/request.c index be7c49a8550..8fc11f09138 100644 --- a/server/request.c +++ b/server/request.c @@ -1555,11 +1555,12 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_sub_req_output_filter(ap_filter_t *f, return APR_SUCCESS; } +extern APR_OPTIONAL_FN_TYPE(authz_some_auth_required) *azh_ap_some_auth_required; AP_DECLARE(int) ap_some_auth_required(request_rec *r) { /* Is there a require line configured for the type of *this* req? */ - +/* const apr_array_header_t *reqs_arr = ap_requires(r); require_line *reqs; int i; @@ -1577,6 +1578,12 @@ AP_DECLARE(int) ap_some_auth_required(request_rec *r) } return 0; +*/ + if (azh_ap_some_auth_required) { + return azh_ap_some_auth_required(r); + } + else + return 0; }