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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
18
#include "http_config.h"
19
#include "apr_strings.h"
20
#include "ap_provider.h"
25
/* per-dir configuration */
27
const char *lockdb_path;
30
extern const dav_hooks_locks dav_hooks_locks_generic;
32
extern module AP_MODULE_DECLARE_DATA dav_lock_module;
34
const char *dav_generic_get_lockdb_path(const request_rec *r)
36
dav_lock_dir_conf *conf;
38
conf = ap_get_module_config(r->per_dir_config, &dav_lock_module);
39
return conf->lockdb_path;
42
static void *dav_lock_create_dir_config(apr_pool_t *p, char *dir)
44
return apr_pcalloc(p, sizeof(dav_lock_dir_conf));
47
static void *dav_lock_merge_dir_config(apr_pool_t *p,
48
void *base, void *overrides)
50
dav_lock_dir_conf *parent = base;
51
dav_lock_dir_conf *child = overrides;
52
dav_lock_dir_conf *newconf;
54
newconf = apr_pcalloc(p, sizeof(*newconf));
56
newconf->lockdb_path =
57
child->lockdb_path ? child->lockdb_path : parent->lockdb_path;
63
* Command handler for the DAVGenericLockDB directive, which is TAKE1
65
static const char *dav_lock_cmd_davlockdb(cmd_parms *cmd, void *config,
68
dav_lock_dir_conf *conf = config;
70
conf->lockdb_path = ap_server_root_relative(cmd->pool, arg1);
72
if (!conf->lockdb_path) {
73
return apr_pstrcat(cmd->pool, "Invalid DAVGenericLockDB path ",
80
static const command_rec dav_lock_cmds[] =
83
AP_INIT_TAKE1("DAVGenericLockDB", dav_lock_cmd_davlockdb, NULL, ACCESS_CONF,
84
"specify a lock database"),
89
static void register_hooks(apr_pool_t *p)
91
ap_register_provider(p, "dav-lock", "generic", "0",
92
&dav_hooks_locks_generic);
95
module AP_MODULE_DECLARE_DATA dav_lock_module =
97
STANDARD20_MODULE_STUFF,
98
dav_lock_create_dir_config, /* dir config creater */
99
dav_lock_merge_dir_config, /* dir merger --- default is to override */
100
NULL, /* server config */
101
NULL, /* merge server config */
102
dav_lock_cmds, /* command table */
103
register_hooks, /* register hooks */