~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to modules/dav/fs/mod_dav_fs.c

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Licensed to the Apache Software Foundation (ASF) under one or more
 
2
 * contributor license agreements.  See the NOTICE file distributed with
 
3
 * this work for additional information regarding copyright ownership.
 
4
 * The ASF licenses this file to You under the Apache License, Version 2.0
 
5
 * (the "License"); you may not use this file except in compliance with
 
6
 * the License.  You may obtain a copy of the License at
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
 
 
17
#include "httpd.h"
 
18
#include "http_config.h"
 
19
#include "apr_strings.h"
 
20
 
 
21
#include "mod_dav.h"
 
22
#include "repos.h"
 
23
 
 
24
/* per-server configuration */
 
25
typedef struct {
 
26
    const char *lockdb_path;
 
27
 
 
28
} dav_fs_server_conf;
 
29
 
 
30
extern module AP_MODULE_DECLARE_DATA dav_fs_module;
 
31
 
 
32
const char *dav_get_lockdb_path(const request_rec *r)
 
33
{
 
34
    dav_fs_server_conf *conf;
 
35
 
 
36
    conf = ap_get_module_config(r->server->module_config, &dav_fs_module);
 
37
    return conf->lockdb_path;
 
38
}
 
39
 
 
40
static void *dav_fs_create_server_config(apr_pool_t *p, server_rec *s)
 
41
{
 
42
    return apr_pcalloc(p, sizeof(dav_fs_server_conf));
 
43
}
 
44
 
 
45
static void *dav_fs_merge_server_config(apr_pool_t *p,
 
46
                                        void *base, void *overrides)
 
47
{
 
48
    dav_fs_server_conf *parent = base;
 
49
    dav_fs_server_conf *child = overrides;
 
50
    dav_fs_server_conf *newconf;
 
51
 
 
52
    newconf = apr_pcalloc(p, sizeof(*newconf));
 
53
 
 
54
    newconf->lockdb_path =
 
55
        child->lockdb_path ? child->lockdb_path : parent->lockdb_path;
 
56
 
 
57
    return newconf;
 
58
}
 
59
 
 
60
/*
 
61
 * Command handler for the DAVLockDB directive, which is TAKE1
 
62
 */
 
63
static const char *dav_fs_cmd_davlockdb(cmd_parms *cmd, void *config,
 
64
                                        const char *arg1)
 
65
{
 
66
    dav_fs_server_conf *conf;
 
67
    conf = ap_get_module_config(cmd->server->module_config,
 
68
                                &dav_fs_module);
 
69
    conf->lockdb_path = ap_server_root_relative(cmd->pool, arg1);
 
70
 
 
71
    if (!conf->lockdb_path) {
 
72
        return apr_pstrcat(cmd->pool, "Invalid DAVLockDB path ",
 
73
                           arg1, NULL);
 
74
    }
 
75
 
 
76
    return NULL;
 
77
}
 
78
 
 
79
static const command_rec dav_fs_cmds[] =
 
80
{
 
81
    /* per server */
 
82
    AP_INIT_TAKE1("DAVLockDB", dav_fs_cmd_davlockdb, NULL, RSRC_CONF,
 
83
                  "specify a lock database"),
 
84
 
 
85
    { NULL }
 
86
};
 
87
 
 
88
static void register_hooks(apr_pool_t *p)
 
89
{
 
90
    dav_hook_gather_propsets(dav_fs_gather_propsets, NULL, NULL,
 
91
                             APR_HOOK_MIDDLE);
 
92
    dav_hook_find_liveprop(dav_fs_find_liveprop, NULL, NULL, APR_HOOK_MIDDLE);
 
93
    dav_hook_insert_all_liveprops(dav_fs_insert_all_liveprops, NULL, NULL,
 
94
                                  APR_HOOK_MIDDLE);
 
95
 
 
96
    dav_fs_register(p);
 
97
}
 
98
 
 
99
module AP_MODULE_DECLARE_DATA dav_fs_module =
 
100
{
 
101
    STANDARD20_MODULE_STUFF,
 
102
    NULL,                        /* dir config creater */
 
103
    NULL,                        /* dir merger --- default is to override */
 
104
    dav_fs_create_server_config, /* server config */
 
105
    dav_fs_merge_server_config,  /* merge server config */
 
106
    dav_fs_cmds,                 /* command table */
 
107
    register_hooks,              /* register hooks */
 
108
};