资源简介
apache ,目前使用最广的web服务器搭建软件。
代码片段和文件信息
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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“
#if APR_HAVE_NETINET_IN_H
#include
#endif
enum allowdeny_type {
T_ENV
T_NENV
T_ALL
T_IP
T_HOST
T_FAIL
};
typedef struct {
apr_int64_t limited;
union {
char *from;
apr_ipsubnet_t *ip;
} 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 order[METHODS];
apr_array_header_t *allows;
apr_array_header_t *denys;
int *satisfy; /* for every method one */
} access_compat_dir_conf;
module AP_MODULE_DECLARE_DATA access_compat_module;
static void *create_access_compat_dir_config(apr_pool_t *p char *dummy)
{
int i;
access_compat_dir_conf *conf =
(access_compat_dir_conf *)apr_pcalloc(p sizeof(access_compat_dir_conf));
for (i = 0; i < METHODS; ++i) {
conf->order[i] = DENY_THEN_ALLOW;
}
conf->allows = apr_array_make(p 1 sizeof(allowdeny));
conf->denys = apr_array_make(p 1 sizeof(allowdeny));
conf->satisfy = apr_palloc(p sizeof(*conf->satisfy) * METHODS);
for (i = 0; i < METHODS; ++i) {
conf->satisfy[i] = SATISFY_NOSPEC;
}
return (void *)conf;
}
static const char *order(cmd_parms *cmd void *dv const char *arg)
{
access_compat_dir_conf *d = (access_compat_dir_conf *) dv;
int i o;
if (!strcasecmp(arg “allowdeny“))
o = ALLOW_THEN_DENY;
else if (!strcasecmp(arg “denyallow“))
o = DENY_THEN_ALLOW;
else if (!strcasecmp(arg “mutual-failure“))
o = MUTUAL_FAILURE;
else
return “unknown order“;
for (i = 0; i < METHODS; ++i)
if (cmd->limited & (AP_METHOD_BIT << i))
d->order[i] = o;
- 上一篇:数字钟课程设计+EWB软件
- 下一篇:5610248fg768p.exe
评论
共有 条评论