Apache HTTPD
mod_dav_lock.c
Go to the documentation of this file.
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#include "ap_provider.h"
21
22#include "mod_dav.h"
23#include "locks.h"
24
25/* per-dir configuration */
26typedef struct {
27 const char *lockdb_path;
29
31
32extern module AP_MODULE_DECLARE_DATA dav_lock_module;
33
35{
37
38 conf = ap_get_module_config(r->per_dir_config, &dav_lock_module);
39 return conf->lockdb_path;
40}
41
43{
44 return apr_pcalloc(p, sizeof(dav_lock_dir_conf));
45}
46
48 void *base, void *overrides)
49{
53
54 newconf = apr_pcalloc(p, sizeof(*newconf));
55
56 newconf->lockdb_path =
57 child->lockdb_path ? child->lockdb_path : parent->lockdb_path;
58
59 return newconf;
60}
61
62/*
63 * Command handler for the DAVGenericLockDB directive, which is TAKE1
64 */
65static const char *dav_lock_cmd_davlockdb(cmd_parms *cmd, void *config,
66 const char *arg1)
67{
68 dav_lock_dir_conf *conf = config;
69
71
72 if (!conf->lockdb_path) {
73 return apr_pstrcat(cmd->pool, "Invalid DAVGenericLockDB path ",
74 arg1, NULL);
75 }
76
77 return NULL;
78}
79
80static const command_rec dav_lock_cmds[] =
81{
82 /* per server */
84 "specify a lock database"),
85
86 { NULL }
87};
88
90{
91 ap_register_provider(p, "dav-lock", "generic", "0",
93}
94
96{
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 */
104};
Apache Provider API.
APR Strings library.
#define AP_INIT_TAKE1(directive, func, mconfig, where, help)
#define ap_get_module_config(v, m)
#define AP_DECLARE_MODULE(foo)
ap_conf_vector_t * base
char * ap_server_root_relative(apr_pool_t *p, const char *fname)
Definition config.c:1594
request_rec * r
apr_status_t ap_register_provider(apr_pool_t *pool, const char *provider_group, const char *provider_name, const char *provider_version, const void *provider)
Definition provider.c:35
#define ACCESS_CONF
const char * dav_generic_get_lockdb_path(const request_rec *r)
#define STANDARD20_MODULE_STUFF
apr_size_t size
apr_pool_t * parent
Definition apr_pools.h:197
#define apr_pcalloc(p, size)
Definition apr_pools.h:465
apr_dir_t * dir
apr_cmdtype_e cmd
Apache Configuration.
HTTP Daemon routines.
Declarations for the generic lock implementation.
apr_pool_t * p
Definition md_event.c:32
DAV extension module for Apache 2.0.*.
static void * dav_lock_create_dir_config(apr_pool_t *p, char *dir)
static void register_hooks(apr_pool_t *p)
static const command_rec dav_lock_cmds[]
const dav_hooks_locks dav_hooks_locks_generic
Definition locks.c:1218
static void * dav_lock_merge_dir_config(apr_pool_t *p, void *base, void *overrides)
static const char * dav_lock_cmd_davlockdb(cmd_parms *cmd, void *config, const char *arg1)
return NULL
Definition mod_so.c:359
const char * lockdb_path
A structure that represents the current request.
Definition httpd.h:845
struct ap_conf_vector_t * per_dir_config
Definition httpd.h:1047