repos.c revision b0fb330a8581c8bfab5e523084f9f39264a52b12
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl/* ====================================================================
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * The Apache Software License, Version 1.1
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * Copyright (c) 2000 The Apache Software Foundation. All rights
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * reserved.
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * Redistribution and use in source and binary forms, with or without
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * modification, are permitted provided that the following conditions
8dd59c49fc0406c986dcb887651133d9978f2249noodl * 1. Redistributions of source code must retain the above copyright
8dd59c49fc0406c986dcb887651133d9978f2249noodl * notice, this list of conditions and the following disclaimer.
2e545ce2450a9953665f701bb05350f0d3f26275nd * 2. Redistributions in binary form must reproduce the above copyright
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * notice, this list of conditions and the following disclaimer in
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * the documentation and/or other materials provided with the
8dd59c49fc0406c986dcb887651133d9978f2249noodl * distribution.
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * 3. The end-user documentation included with the redistribution,
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen * if any, must include the following acknowledgment:
3f08db06526d6901aa08c110b5bc7dde6bc39905nd * "This product includes software developed by the
8dd59c49fc0406c986dcb887651133d9978f2249noodl * Apache Software Foundation (http://www.apache.org/)."
8dd59c49fc0406c986dcb887651133d9978f2249noodl * Alternately, this acknowledgment may appear in the software itself,
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * if and wherever such third-party acknowledgments normally appear.
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * 4. The names "Apache" and "Apache Software Foundation" must
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi * not be used to endorse or promote products derived from this
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * software without prior written permission. For written
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi * permission, please contact apache@apache.org.
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * 5. Products derived from this software may not be called "Apache",
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * nor may "Apache" appear in their name, without prior written
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi * permission of the Apache Software Foundation.
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8dd59c49fc0406c986dcb887651133d9978f2249noodl * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
8dd59c49fc0406c986dcb887651133d9978f2249noodl * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * SUCH DAMAGE.
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * ====================================================================
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * This software consists of voluntary contributions made by many
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * individuals on behalf of the Apache Software Foundation. For more
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl * information on the Apache Software Foundation, please see
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl** DAV filesystem-based repository provider
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl#include "http_protocol.h" /* for ap_set_* (in dav_fs_set_headers) */
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl/* to assist in debugging mod_dav's GET handling */
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl#define DAV_FS_COPY_BLOCKSIZE 16384 /* copy 16k at a time */
8dd59c49fc0406c986dcb887651133d9978f2249noodl/* context needed to identify a resource */
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl pool *pool; /* memory storage pool associated with request */
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl/* private context for doing a filesystem walk */
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodltypedef struct {
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl/* pull this in from the other source file */
f02c4cd65aabbf1c9076b8bae71a267589d80c41noodl/* forward-declare this sucker */
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashistatic const dav_hooks_repository dav_hooks_repository_fs;
0d0ba3a410038e179b695446bb149cce6264e0abnd** The Provider ID is used to differentiate "logical" providers that use
727872d18412fc021f03969b8641810d8896820bhumbedooh** the same set of hook functions. Essentially, the ID is an instance
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh** handle and the hooks are a vtable.
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh** In this module, we only have a single provider for each type, so we
727872d18412fc021f03969b8641810d8896820bhumbedooh** actually ignore the Provider ID.
0d0ba3a410038e179b695446bb149cce6264e0abnd** The namespace URIs that we use. This list and the enumeration must
0d0ba3a410038e179b695446bb149cce6264e0abnd** stay in sync.
727872d18412fc021f03969b8641810d8896820bhumbedoohstatic const char * const dav_fs_namespace_uris[] =
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd DAV_FS_URI_MYPROPS /* the namespace URI for our custom props */
/* NOTE: the magic "200" is derived from the ranges in mod_dav.h */
int ns;
const char * name;
int propid;
struct dav_stream {
pool *p;
int fd;
void dav_fs_dir_file_name(
const char **dirpath_p,
const char **fname_p)
if (amt > 0) {
int is_move,
pool * p,
const char *src,
const char *dst,
int fdi;
int fdo;
if (len == 0)
return err;
return NULL;
int is_move,
pool * p,
const char *src;
const char *dst;
return NULL;
return NULL;
const char *src_dir;
const char *src_file;
const char *src_state1;
const char *src_state2;
const char *dst_dir;
const char *dst_file;
const char *dst_state1;
const char *dst_state2;
#if DAV_DEBUG
pbuf);
pbuf);
return err;
const char *dirpath;
const char *fname;
const char *state1;
const char *state2;
const char *pathname;
NULL);
NULL);
return NULL;
request_rec *r,
const char *root_dir,
const char *workspace)
char *filename;
#if MODULE_MAGIC_NUMBER_MAJOR > 19990320 || (MODULE_MAGIC_NUMBER_MAJOR == 19990320 && MODULE_MAGIC_NUMBER_MINOR >= 8)
return resource;
char *dirpath;
#ifdef WIN32
return NULL;
return parent_resource;
static int dav_fs_is_same_resource(
#ifdef WIN32
static int dav_fs_is_parent_resource(
int flags;
switch (mode) {
case DAV_MODE_READ:
case DAV_MODE_READ_SEEKABLE:
case DAV_MODE_WRITE_TRUNC:
case DAV_MODE_WRITE_SEEKABLE:
ds->p = p;
return NULL;
if (!commit) {
return NULL;
return NULL;
return NULL;
return NULL;
return NULL;
ap_set_etag(r);
return NULL;
static const char * dav_fs_get_pathname(
void **free_handle_p)
return NULL;
return NULL;
return err;
int is_move,
int depth,
return err;
return NULL;
return err;
int depth,
#if DAV_DEBUG
return err;
int can_rename = 0;
#if DAV_DEBUG
const char *dirpath;
if (!can_rename) {
return err;
return NULL;
err);
err);
int result;
if (result != 0) {
return NULL;
return err;
return NULL;
return err;
return NULL;
return err;
return err;
return err;
return err;
return NULL;
#if DAV_DEBUG
int ns;
const int *ns_map,
const char *value;
int ns;
return DAV_PROP_INSERT_NOTME;
** properties; the NOTDEF return code indicates that dav_props.c should
return DAV_PROP_INSERT_NOTDEF;
switch (propid) {
buf);
return DAV_PROP_INSERT_NOTDEF;
case DAV_PROPID_FS_getetag:
buf);
case DAV_PROPID_FS_executable:
#ifdef WIN32
return DAV_PROP_INSERT_NOTDEF;
return DAV_PROP_INSERT_NOTDEF;
case DAV_PROPID_FS_source:
return DAV_PROP_INSERT_NOTDEF;
if (insvalue) {
return which;
#ifndef WIN32
int propid)
return DAV_PROP_RW_NOTME;
#ifndef WIN32
return DAV_PROP_RW_YES;
return DAV_PROP_RW_NO;
int operation,
void **context,
int *defer_to_dead)
char value;
return NULL;
? NULL
/* DBG3("name=%s cdata=%s f_cdata=%s",elem->name,cdata ? cdata->text : "[null]",f_cdata ? f_cdata->text : "[null]"); */
goto too_long;
goto too_long;
return NULL;
int operation,
void *context,
return NULL;
if (value)
return NULL;
int operation,
void *context,
int operation,
void *context,
if (value)
return NULL;
#ifdef WIN32
NULL,