]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Reimplement ap_some_auth_required as an optional function since the data has moved...
authorBradley Nicholes <bnicholes@apache.org>
Fri, 2 Dec 2005 01:19:07 +0000 (01:19 +0000)
committerBradley Nicholes <bnicholes@apache.org>
Fri, 2 Dec 2005 01:19:07 +0000 (01:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/authz-dev@351547 13f79535-47bb-0310-9956-ffa450edef68

include/http_core.h
modules/aaa/mod_authz_host.c
server/core.c
server/request.c

index 60d0d0312c2f4eabdf3bd83d64e5d0d4f0189c9f..874974f25cb353fec24c56e0434aefab992e7d8a 100644 (file)
@@ -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));
index 71bd59600f68d511df1c09a527003441d1f16c0d..09e4447aab7485937b9f1354b49b16bec0db7554 100644 (file)
@@ -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);
index 57a03fedbee5a2060eccab366ce25832141f07ee..8af4c048381bbca3b430c19422473b4306304a5a 100644 (file)
@@ -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);
index be7c49a8550e7ae2962adb1d96e38946753e1054..8fc11f0913830655734db678a1338905632c4aa6 100644 (file)
@@ -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;
 }