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));
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)
{
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);
* 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);
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;
}
return 0;
+*/
+ if (azh_ap_some_auth_required) {
+ return azh_ap_some_auth_required(r);
+ }
+ else
+ return 0;
}