APACHE_MODPATH_INIT(dav/fs)
-dnl ### dav_fs is not a module, but we want to have it enabled/disabled
-dnl ### like one. with a bit o' work, dav_fs *will* become a true module.
-
-dnl ### this is snarfed from APACHE_MODULE. it does not allow dav_fs to be
-dnl ### shared, and it does not add it into MODLIST. basically... it is
-dnl ### just a static library to link into Apache at this point
-AC_DEFUN(DAV_FS_MODULE,[
- AC_MSG_CHECKING(whether to enable mod_$1)
- define([optname],[ --]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
- AC_ARG_ENABLE(translit($1,_,-),optname() substr([ ],len(optname()))$2,,enable_$1=ifelse($5,,no,$5))
- undefine([optname])dnl
- AC_MSG_RESULT($enable_$1)
- if test "$enable_$1" != "no"; then
- APACHE_MODPATH_ADD($1, , $3)
- fi
-])dnl
-
-
dnl ### we want to default this based on whether dav is being used...
dnl ### but there is no ordering to the config.m4 files right now...
-DAV_FS_MODULE(dav_fs, DAV provider for the filesystem, , , no)
-
-
+APACHE_MODULE(dav_fs, DAV provider for the filesystem, , , no)
if test "$enable_dav_fs" = "yes"; then
apache_need_sdbm=yes
fi
--- /dev/null
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+#include "httpd.h"
+#include "http_config.h"
+
+#include "mod_dav.h"
+#include "repos.h"
+
+/* per-server configuration */
+typedef struct {
+ const char *lockdb_path;
+
+} dav_fs_server_conf;
+
+extern module MODULE_VAR_EXPORT dav_fs_module;
+
+const char *dav_get_lockdb_path(const request_rec *r)
+{
+ dav_fs_server_conf *conf;
+
+ conf = ap_get_module_config(r->server->module_config, &dav_fs_module);
+ return conf->lockdb_path;
+}
+
+static void *dav_fs_create_server_config(ap_pool_t *p, server_rec *s)
+{
+ return ap_pcalloc(p, sizeof(dav_fs_server_conf));
+}
+
+static void *dav_fs_merge_server_config(ap_pool_t *p,
+ void *base, void *overrides)
+{
+ dav_fs_server_conf *parent = base;
+ dav_fs_server_conf *child = overrides;
+ dav_fs_server_conf *newconf;
+
+ newconf = ap_pcalloc(p, sizeof(*newconf));
+
+ newconf->lockdb_path =
+ child->lockdb_path ? child->lockdb_path : parent->lockdb_path;
+
+ return newconf;
+}
+
+/*
+ * Command handler for the DAVLockDB directive, which is TAKE1
+ */
+static const char *dav_fs_cmd_davlockdb(cmd_parms *cmd, void *config,
+ const char *arg1)
+{
+ dav_fs_server_conf *conf;
+
+ conf = ap_get_module_config(cmd->server->module_config,
+ &dav_fs_module);
+ arg1 = ap_os_canonical_filename(cmd->pool, arg1);
+ conf->lockdb_path = ap_server_root_relative(cmd->pool, arg1);
+
+ return NULL;
+}
+
+static const command_rec dav_fs_cmds[] =
+{
+ /* per server */
+ AP_INIT_TAKE1("DAVLockDB", dav_fs_cmd_davlockdb, NULL, RSRC_CONF,
+ "specify a lock database"),
+
+ { NULL }
+};
+
+static void register_hooks(void)
+{
+ /* nothing yet */
+}
+
+module MODULE_VAR_EXPORT dav_fs_module =
+{
+ STANDARD20_MODULE_STUFF,
+ NULL, /* dir config creater */
+ NULL, /* dir merger --- default is to override */
+ dav_fs_create_server_config, /* server config */
+ dav_fs_merge_server_config, /* merge server config */
+ dav_fs_cmds, /* command table */
+ NULL, /* handlers */
+ register_hooks, /* register hooks */
+};
/* per-server configuration */
typedef struct {
- const char *lockdb_path; /* lock database path */
-
uuid_state st; /* UUID state for opaquelocktoken */
} dav_server_conf;
newconf = (dav_server_conf *) ap_pcalloc(p, sizeof(*newconf));
- newconf->lockdb_path = NULL;
dav_create_uuid_state(&newconf->st);
return newconf;
static void *dav_merge_server_config(ap_pool_t *p, void *base, void *overrides)
{
- dav_server_conf *parent = base;
dav_server_conf *child = overrides;
dav_server_conf *newconf;
newconf = (dav_server_conf *) ap_pcalloc(p, sizeof(*newconf));
- newconf->lockdb_path = DAV_INHERIT_VALUE(parent, child, lockdb_path);
-
+ /* ### hmm. we should share the uuid state rather than copy it. if we
+ ### do another merge, then we'll just get the old one, rather than
+ ### an updated state.
+ ### of course... the UUID generation should move into APR
+ */
memcpy(&newconf->st, &child->st, sizeof(newconf->st));
return newconf;
return &conf->st;
}
-const char *dav_get_lockdb_path(const request_rec *r)
-{
- dav_server_conf *conf;
-
- conf = ap_get_module_config(r->server->module_config, &dav_module);
- return conf->lockdb_path;
-}
-
ap_table_t *dav_get_dir_params(const request_rec *r)
{
dav_dir_conf *conf;
const dav_dyn_hooks *hooks;
static const dav_dyn_hooks null_hooks = { { 0 } };
- /* Call repository hook to resolve resource */
conf = (dav_dir_conf *) ap_get_module_config(r->per_dir_config,
&dav_module);
switch (provider_type) {
return NULL;
}
-/*
- * Command handler for the DAVLockDB directive, which is TAKE1
- */
-static const char *dav_cmd_davlockdb(cmd_parms *cmd, void *config,
- const char *arg1)
-{
- dav_server_conf *conf;
-
- conf = (dav_server_conf *) ap_get_module_config(cmd->server->module_config,
- &dav_module);
- arg1 = ap_os_canonical_filename(cmd->pool, arg1);
- conf->lockdb_path = ap_server_root_relative(cmd->pool, arg1);
-
- return NULL;
-}
-
/*
* Command handler for DAVMinTimeout directive, which is TAKE1
*/
AP_INIT_FLAG("DAV", dav_cmd_dav, NULL, ACCESS_CONF,
"turn DAV on/off for a directory or location"),
- /* per server */
- AP_INIT_TAKE1("DAVLockDB", dav_cmd_davlockdb, NULL, RSRC_CONF,
- "specify a lock database"),
-
/* per directory/location, or per server */
AP_INIT_TAKE1("DAVMinTimeout", dav_cmd_davmintimeout, NULL,
ACCESS_CONF|RSRC_CONF,