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"
24 /* per-server configuration */
26 const char *lockdb_path
;
30 extern module AP_MODULE_DECLARE_DATA dav_fs_module
;
32 const char *dav_get_lockdb_path(const request_rec
*r
)
34 dav_fs_server_conf
*conf
;
36 conf
= ap_get_module_config(r
->server
->module_config
, &dav_fs_module
);
37 return conf
->lockdb_path
;
40 static void *dav_fs_create_server_config(apr_pool_t
*p
, server_rec
*s
)
42 return apr_pcalloc(p
, sizeof(dav_fs_server_conf
));
45 static void *dav_fs_merge_server_config(apr_pool_t
*p
,
46 void *base
, void *overrides
)
48 dav_fs_server_conf
*parent
= base
;
49 dav_fs_server_conf
*child
= overrides
;
50 dav_fs_server_conf
*newconf
;
52 newconf
= apr_pcalloc(p
, sizeof(*newconf
));
54 newconf
->lockdb_path
=
55 child
->lockdb_path
? child
->lockdb_path
: parent
->lockdb_path
;
61 * Command handler for the DAVLockDB directive, which is TAKE1
63 static const char *dav_fs_cmd_davlockdb(cmd_parms
*cmd
, void *config
,
66 dav_fs_server_conf
*conf
;
67 conf
= ap_get_module_config(cmd
->server
->module_config
,
69 conf
->lockdb_path
= ap_server_root_relative(cmd
->pool
, arg1
);
71 if (!conf
->lockdb_path
) {
72 return apr_pstrcat(cmd
->pool
, "Invalid DAVLockDB path ",
79 static const command_rec dav_fs_cmds
[] =
82 AP_INIT_TAKE1("DAVLockDB", dav_fs_cmd_davlockdb
, NULL
, RSRC_CONF
,
83 "specify a lock database"),
88 static void register_hooks(apr_pool_t
*p
)
90 dav_hook_gather_propsets(dav_fs_gather_propsets
, NULL
, NULL
,
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
,
99 module AP_MODULE_DECLARE_DATA dav_fs_module
=
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 */