mod_access_compat.c revision e684537a0db1085ac01f3743e1630ebe9bfdaf10
/* Copyright 2002-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Security options etc.
*
* Module derived from code originally written by Rob McCool
*
*/
#include "apr_strings.h"
#include "apr_network_io.h"
#include "apr_md5.h"
#define APR_WANT_STRFUNC
#define APR_WANT_BYTEFUNC
#include "apr_want.h"
#include "ap_config.h"
#include "httpd.h"
#include "http_core.h"
#include "http_config.h"
#include "http_log.h"
#include "http_protocol.h"
#include "http_request.h"
#include "mod_auth.h"
#endif
enum allowdeny_type {
T_IP,
};
typedef struct {
union {
char *from;
} x;
enum allowdeny_type type;
} allowdeny;
/* things in the 'order' array */
#define DENY_THEN_ALLOW 0
#define ALLOW_THEN_DENY 1
#define MUTUAL_FAILURE 2
typedef struct {
int *satisfy; /* for every method one */
{
int i;
for (i = 0; i < METHODS; ++i) {
}
for (i = 0; i < METHODS; ++i) {
}
return (void *)conf;
}
{
int i, o;
"The 'Order' directive has been deprecated. "
"Consider using '<SatisfyAll><SatisfyOne>' directives.");
o = ALLOW_THEN_DENY;
o = DENY_THEN_ALLOW;
o = MUTUAL_FAILURE;
else
return "unknown order";
for (i = 0; i < METHODS; ++i)
d->order[i] = o;
return NULL;
}
{
int satisfy = SATISFY_NOSPEC;
int i;
"The 'Satisfy' directive has been deprecated. "
"Consider using '<SatisfyAll><SatisfyOne>' directives.");
}
}
else {
return "Satisfy either 'any' or 'all'.";
}
for (i = 0; i < METHODS; ++i) {
}
}
return NULL;
}
const char *where_c)
{
allowdeny *a;
char *s;
char msgbuf[120];
"Consider using one of the host providers in mod_authz_host.");
return "allow and deny must be followed by 'from'";
a->x.from += 4;
}
}
*s++ = '\0';
if(APR_STATUS_IS_EINVAL(rv)) {
/* looked nothing like an IP address */
return "An IP address was expected";
}
else if (rv != APR_SUCCESS) {
}
}
if (rv != APR_SUCCESS) {
}
}
else { /* no slash, didn't look like an IP address => must be a host */
}
return NULL;
}
static char its_an_allow;
static const command_rec access_compat_cmds[] =
{
"'allow,deny', 'deny,allow', or 'mutual-failure'"),
"'from' followed by hostnames or IP-address wildcards"),
"'from' followed by hostnames or IP-address wildcards"),
"access policy if both allow and require used ('all' or 'any')"),
{NULL}
};
{
return 0;
}
/* Make sure we matched an *entire* subdomain --- if the user
* to be able to get in.
*/
return 1; /* matched whole thing */
}
else {
}
}
else {
return 0;
}
}
{
int i;
int gothost = 0;
const char *remotehost = NULL;
for (i = 0; i < a->nelts; ++i) {
continue;
}
case T_ENV:
return 1;
}
break;
case T_ALL:
return 1;
case T_IP:
return 1;
}
break;
case T_HOST:
if (!gothost) {
int remotehost_is_ip;
r->per_dir_config,
gothost = 1;
}
else {
gothost = 2;
}
}
return 1;
}
break;
case T_FAIL:
/* do nothing? */
break;
}
}
return 0;
}
static int ap_satisfies(request_rec *r)
{
}
static int check_dir_access(request_rec *r)
{
int method = r->method_number;
}
}
}
}
}
}
else {
}
else {
}
}
}
else {
/* If Satisfy is Any and authorization is required, then
defer to the authorization stage */
}
}
if (ret == HTTP_FORBIDDEN) {
"client denied by server configuration: %s",
r->filename);
}
return ret;
}
static void register_hooks(apr_pool_t *p)
{
/* This can be access checker since we don't require r->user to be set. */
}
{
create_access_compat_dir_config, /* dir config creater */
NULL, /* dir merger --- default is to override */
NULL, /* server config */
NULL, /* merge server config */
register_hooks /* register hooks */
};