41#define DEBUG_GET_HANDLER 0
43#define DAV_FS_COPY_BLOCKSIZE 16384
89#define DAV_WALKTYPE_HIDDEN 0x4000
92#define DAV_WALKTYPE_POSTFIX 0x8000
94#define DAV_CALLTYPE_POSTFIX 1000
111 "http://apache.org/dav/props/",
129#define DAV_FS_HAS_EXECUTABLE
130#define DAV_FINFO_MASK (APR_FINFO_LINK | APR_FINFO_TYPE | APR_FINFO_INODE | \
131 APR_FINFO_SIZE | APR_FINFO_CTIME | APR_FINFO_MTIME | \
135#define DAV_FINFO_MASK (APR_FINFO_LINK | APR_FINFO_TYPE | APR_FINFO_INODE | \
136 APR_FINFO_SIZE | APR_FINFO_CTIME | APR_FINFO_MTIME)
142#define DAV_PROPID_FS_executable 1
147#define DAV_FS_TMP_PREFIX ".davfs.tmp"
207#define MAP_IO2HTTP(e) (APR_STATUS_IS_ENOSPC(e) ? HTTP_INSUFFICIENT_STORAGE : \
208 APR_STATUS_IS_ENOENT(e) ? HTTP_CONFLICT : \
209 HTTP_INTERNAL_SERVER_ERROR)
215 int depth,
int is_move,
287 "An incomplete/bad path was found in "
288 "dav_fs_dir_file_name.");
309 tms.tm_year + 1900,
tms.tm_mon + 1,
tms.tm_mday,
354 "Could not set permissions on destination");
368 "Could not open file for reading");
378 "Could not open file for writing");
397 "Could not delete output after read "
398 "failure. Server is now in an "
399 "inconsistent state.");
404 "Could not read input file");
424 "Could not delete output after write "
425 "failure. Server is now in an "
426 "inconsistent state.");
430 "Could not write output file");
448 "file %s after move to %s. The "
449 "server may be in an "
450 "inconsistent state.",
src,
dst));
458 "Could not remove source or destination "
459 "file. Server is now in an inconsistent "
465 "Could not remove source file after move. "
466 "Destination was removed to ensure consistency.");
508 "Could not create internal state directory");
518 "State directory disappeared");
526 "State directory is actually a file");
542 "Could not move state file.");
581 "DESIGN ERROR: dav_dbm_get_statefiles() "
582 "returned inconsistent results.");
605 "Could not fully copy/move the properties. "
606 "The server is now in an inconsistent state.";
638 "Could not remove properties.");
653 "Could not fully remove properties. "
654 "The server is now in an inconsistent "
708 if (
len > 1 &&
s[
len - 1] ==
'/') {
757 "The URL contains extraneous path "
758 "components. The resource could not "
816 parent_resource =
apr_pcalloc(
ctx->pool,
sizeof(*parent_resource));
824 if (strlen(
uri) > 1 &&
uri[strlen(
uri) - 1] ==
'/')
825 uri[strlen(
uri) - 1] =
'\0';
826 parent_resource->
uri =
uri;
832 parent_resource->
exists = 1;
898 num = (
num + 1) % ( 1 << 23 );
933 ds->unlink_on_error = 0;
947 ds->unlink_on_error = 1;
955 "resource for writing: %s.",
965 "resource for reading: %s.",
973 "a resource for writing: %s.",
999 "There was a problem removing (rolling "
1000 "back) the resource "
1001 "when it was being closed.");
1009 "There was a problem writing the file "
1010 "atomically after writes.");
1026 "There is not enough storage to write to "
1032 "An error occurred while writing to a "
1048 "Could not seek to specified position in the "
1055#if DEBUG_GET_HANDLER
1100 "Cannot GET this type of resource.");
1104 "There is no default response to GET for a "
1112 "File permissions deny server access.");
1124 "Could not write contents to filter.");
1141 "There is not enough storage to create "
1142 "this collection.");
1146 "Cannot create collection; intermediate "
1147 "collection does not exist.");
1152 "Unable to create collection.");
1239 if (
src->collection) {
1265 "Error(s) occurred on some resources during "
1266 "the COPY/MOVE process.");
1274 src->info->pathname,
dst->info->pathname,
1277 &work_buf)) !=
NULL) {
1295 if (
src->hooks !=
dst->hooks) {
1301 "DESIGN ERROR: a mix of repositories "
1302 "was passed to copy_resource.");
1307 response)) ==
NULL) {
1311 dst->collection =
src->collection;
1328 if (
src->hooks !=
dst->hooks) {
1334 "DESIGN ERROR: a mix of repositories "
1335 "was passed to move_resource.");
1346 response)) ==
NULL) {
1349 dst->collection =
src->collection;
1351 src->collection = 0;
1363 "Could not rename resource.");
1368 dst->collection =
src->collection;
1370 src->collection = 0;
1384 "The resource was moved, but a failure "
1385 "occurred during the move of its "
1386 "properties. The resource could not be "
1387 "restored to its original location. The "
1388 "server is now in an inconsistent state.",
1394 src->collection =
dst->collection;
1396 dst->collection = 0;
1401 "The resource was moved, but a failure "
1402 "occurred during the move of its properties. "
1403 "The resource was moved back to its original "
1404 "location, but its properties may have been "
1405 "partially moved. The server may be in an "
1406 "inconsistent state.",
1476 "Error(s) occurred on some resources during "
1477 "the deletion process.");
1510 int isdir =
fsctx->res1.collection;
1523 if (depth == 0 || !isdir) {
1530 fsctx->path1.buf[
fsctx->path1.cur_len++] =
'/';
1531 fsctx->path1.buf[
fsctx->path1.cur_len] =
'\0';
1536 fsctx->path2.buf[
fsctx->path2.cur_len++] =
'/';
1537 fsctx->path2.buf[
fsctx->path2.cur_len] =
'\0';
1543 fsctx->res1.exists = 1;
1546 fsctx->res1.collection = 0;
1547 fsctx->res2.collection = 0;
1560 if (
dirent.name[0] ==
'.'
1561 && (
len == 1 || (
dirent.name[1] ==
'.' &&
len == 2))) {
1593 APLOGNO(10472)
"could not access file (%s) during directory walk",
1645 fsctx->uri_buf.buf[
fsctx->uri_buf.cur_len - 1] =
'/';
1646 fsctx->uri_buf.buf[
fsctx->uri_buf.cur_len] =
'\0';
1649 fsctx->res1.collection = 1;
1650 fsctx->res2.collection = 1;
1664 fsctx->res1.collection = 0;
1665 fsctx->res2.collection = 0;
1681 fsctx->path1.buf[
fsctx->path1.cur_len - 1] =
'\0';
1684 fsctx->res1.collection = 1;
1692 fsctx->path1.buf[
fsctx->path1.cur_len - 1] =
'/';
1695 fsctx->res1.exists = 0;
1696 fsctx->res1.collection = 0;
1762 if (locks !=
NULL &&
1773 fsctx->res1.exists = 1;
1778 fsctx->path1.buf[--
fsctx->path1.cur_len] =
'\0';
1779 fsctx->uri_buf.buf[--
fsctx->uri_buf.cur_len] =
'\0';
1781 fsctx->path2.buf[--
fsctx->path2.cur_len] =
'\0';
1785 fsctx->res1.collection = 1;
1794 int depth,
int is_move,
1806 "DESIGN ERROR: walker called to walk locknull "
1807 "resources, but a lockdb was not provided.");
1831 cm_ctx.is_move = is_move;
1837 fsctx.res2.exists = 0;
1838 fsctx.res2.collection = 0;
1857 if (
fsctx.res1.collection
1858 &&
fsctx.uri_buf.buf[
fsctx.uri_buf.cur_len - 1] !=
'/') {
1861 fsctx.uri_buf.buf[
fsctx.uri_buf.cur_len++] =
'/';
1862 fsctx.uri_buf.buf[
fsctx.uri_buf.cur_len] =
'\0';
1873 *response =
fsctx.wres.response;
1896 er.vlist_validator =
NULL;
1898 er.finfo = &
ctx->finfo;
1899 er.pathname =
ctx->pathname;
1917#if DEBUG_GET_HANDLER
2033 "<D:supported-live-property D:name=\"",
2035 "\" D:namespace=\"",
2049#ifdef DAV_FS_HAS_EXECUTABLE
2078 "The 'executable' property cannot be removed.");
2086 :
elem->first_child->following_cdata.first;
2093 "The 'executable' property expects a single "
2094 "character, valued 'T' or 'F'. There was no "
2095 "value submitted.");
2108 "The 'executable' property expects a single "
2109 "character, valued 'T' or 'F'. The value "
2110 "submitted is invalid.");
2119 "The 'executable' property expects a single "
2120 "character, valued 'T' or 'F'. The value submitted "
2121 "has too many characters.");
2151 "Could not set the executable flag of the "
2152 "target resource.");
2189 "After a failure occurred, the resource's "
2190 "executable flag could not be restored.");
2225#ifdef DAV_FS_HAS_EXECUTABLE
2227 "<http://apache.org/dav/propset/fs/1>";
2267#ifdef DAV_FS_HAS_EXECUTABLE
const char apr_size_t len
APR-UTIL Buckets/Bucket Brigades.
#define APLOG_USE_MODULE(foo)
apr_status_t ap_pass_brigade(ap_filter_t *filter, apr_bucket_brigade *bucket)
const unsigned char * buf
void ap_set_etag(request_rec *r)
void ap_set_accept_ranges(request_rec *r)
void ap_set_content_length(request_rec *r, apr_off_t length)
void ap_set_last_modified(request_rec *r)
char * ap_make_etag_ex(request_rec *r, etag_rec *er)
void ap_update_mtime(request_rec *r, apr_time_t dependency_mtime)
#define APR_STATUS_IS_EXDEV(s)
#define APR_STATUS_IS_EEXIST(s)
#define APR_STATUS_IS_ENOSPC(s)
#define APR_STATUS_IS_ENOENT(s)
#define APR_BRIGADE_INSERT_TAIL(b, e)
apr_brigade_flush void * ctx
apr_pool_t apr_dbd_t const char const char * label
apr_dbd_transaction_t int mode
apr_pool_t const char * params
const char const char * pathname
const char apr_ssize_t int flags
const apr_xml_elem int style
const apr_xml_elem int apr_array_header_t int const char ** pbuf
#define HTTP_MULTI_STATUS
#define HTTP_INSUFFICIENT_STORAGE
#define HTTP_INTERNAL_SERVER_ERROR
#define ap_is_HTTP_SERVER_ERROR(x)
void dav_fs_register(apr_pool_t *p)
long dav_get_liveprop_info(int propid, const dav_liveprop_group *group, const dav_liveprop_spec **info)
void dav_buffer_init(apr_pool_t *p, dav_buffer *pbuf, const char *str)
const dav_hooks_db dav_hooks_db_dbm
apr_pool_t * dav_fs_pool(const dav_resource *resource)
void dav_buffer_place_mem(apr_pool_t *p, dav_buffer *pbuf, const void *mem, apr_size_t amt, apr_size_t pad)
const char * dav_fs_pathname(const dav_resource *resource)
int dav_fs_find_liveprop(const dav_resource *resource, const char *ns_uri, const char *name, const dav_hooks_liveprop **hooks)
void dav_register_liveprop_group(apr_pool_t *p, const dav_liveprop_group *group)
dav_error * dav_fs_dir_file_name(const dav_resource *resource, const char **dirpath_p, const char **fname_p)
dav_error * dav_lock_query(dav_lockdb *lockdb, const dav_resource *resource, dav_lock **locks)
void dav_dbm_get_statefiles(apr_pool_t *p, const char *fname, const char **state1, const char **state2)
void dav_check_bufsize(apr_pool_t *p, dav_buffer *pbuf, apr_size_t extra_needed)
int dav_do_find_liveprop(const char *ns_uri, const char *name, const dav_liveprop_group *group, const dav_hooks_liveprop **hooks)
void dav_register_provider(apr_pool_t *p, const char *name, const dav_provider *hooks)
#define DAV_STYLE_ISO8601
dav_error * dav_push_error(apr_pool_t *p, int status, int error_id, const char *desc, dav_error *prev)
dav_error * dav_fs_get_locknull_members(const dav_resource *resource, dav_buffer *pbuf)
void dav_fs_insert_all_liveprops(request_rec *r, const dav_resource *resource, dav_prop_insert what, apr_text_header *phdr)
void dav_set_bufsize(apr_pool_t *p, dav_buffer *pbuf, apr_size_t size)
dav_error * dav_new_error(apr_pool_t *p, int status, int error_id, apr_status_t aprerr, const char *desc)
void dav_add_response(dav_walk_resource *wres, int status, dav_get_props_result *propstats)
void dav_fs_gather_propsets(apr_array_header_t *uris)
struct dav_liveprop_rollback dav_liveprop_rollback
@ DAV_PROPID_getcontentlength
@ DAV_PROPID_creationdate
@ DAV_PROPID_getlastmodified
@ DAV_MODE_WRITE_SEEKABLE
@ DAV_CALLTYPE_COLLECTION
@ DAV_RESOURCE_TYPE_VERSION
@ DAV_RESOURCE_TYPE_REGULAR
@ DAV_RESOURCE_TYPE_WORKING
char * ap_make_dirstr_parent(apr_pool_t *p, const char *s)
const char int apr_pool_t * pool
apr_int32_t apr_fileperms_t
const char apr_fileperms_t perms
apr_seek_where_t apr_off_t * offset
apr_array_header_t ** result
apr_interval_time_t apr_int32_t * num
#define apr_pcalloc(p, size)
apr_size_t const char * filename
apr_int32_t apr_int32_t apr_int32_t err
APR_DECLARE_DATA const char apr_month_snames[12][4]
APR_DECLARE_DATA const char apr_day_snames[7][4]
DAV extension module for Apache 2.0.*.
#define DAV_WALKTYPE_AUTH
#define DAV_WALKTYPE_TOLERANT
#define DAV_PROP_OP_DELETE
#define DAV_WALKTYPE_LOCKNULL
#define DAV_WALKTYPE_NORMAL
static const char *const hooks[]
static const dav_liveprop_spec dav_fs_props[]
static apr_status_t dav_fs_mktemp(apr_file_t **fp, char *templ, apr_pool_t *p)
static dav_error * dav_fs_patch_rollback(const dav_resource *resource, int operation, void *context, dav_liveprop_rollback *rollback_ctx)
static dav_error * dav_fs_seek_stream(dav_stream *stream, apr_off_t abs_pos)
#define DAV_FS_TMP_PREFIX
static dav_error * dav_fs_walk(const dav_walk_params *params, int depth, dav_response **response)
static dav_error * dav_fs_close_stream(dav_stream *stream, int commit)
static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource, int propid, dav_prop_insert what, apr_text_header *phdr)
static const char *const dav_fs_namespace_uris[]
#define DAV_WALKTYPE_HIDDEN
static dav_error * dav_fs_patch_exec(const dav_resource *resource, const apr_xml_elem *elem, int operation, void *context, dav_liveprop_rollback **rollback_ctx)
static dav_error * dav_fs_copymove_walker(dav_walk_resource *wres, int calltype)
static const dav_liveprop_group dav_fs_liveprop_group
#define DAV_WALKTYPE_POSTFIX
static const dav_provider dav_fs_provider
static dav_error * dav_fs_internal_walk(const dav_walk_params *params, int depth, int is_move, const dav_resource *root_dst, dav_response **response)
static dav_error * dav_fs_get_parent_resource(const dav_resource *resource, dav_resource **result_parent)
static dav_error * dav_fs_deleteset(apr_pool_t *p, const dav_resource *resource)
static int dav_fs_is_writable(const dav_resource *resource, int propid)
static dav_error * dav_fs_write_stream(dav_stream *stream, const void *buf, apr_size_t bufsize)
static const char * dav_fs_getetag(const dav_resource *resource)
static dav_error * dav_fs_delete_walker(dav_walk_resource *wres, int calltype)
static int dav_fs_is_same_resource(const dav_resource *res1, const dav_resource *res2)
const dav_hooks_locks dav_hooks_locks_fs
static void dav_format_time(int style, apr_time_t sec, char *buf, apr_size_t buflen)
static dav_error * dav_fs_walker(dav_fs_walker_context *fsctx, int depth)
static int dav_fs_is_parent_resource(const dav_resource *res1, const dav_resource *res2)
static const dav_hooks_repository dav_hooks_repository_fs
static dav_error * dav_fs_copy_resource(const dav_resource *src, dav_resource *dst, int depth, dav_response **response)
static request_rec * dav_fs_get_request_rec(const dav_resource *resource)
static dav_error * dav_fs_move_resource(dav_resource *src, dav_resource *dst, dav_response **response)
static dav_error * dav_fs_copymove_resource(int is_move, const dav_resource *src, const dav_resource *dst, int depth, dav_response **response)
#define DAV_CALLTYPE_POSTFIX
static dav_error * dav_fs_patch_validate(const dav_resource *resource, const apr_xml_elem *elem, int operation, void **context, int *defer_to_dead)
#define DAV_PROPID_FS_executable
static dav_error * dav_fs_get_resource(request_rec *r, const char *root_dir, const char *label, int use_checked_in, dav_resource **result_resource)
#define DEBUG_GET_HANDLER
static dav_error * dav_fs_copymoveset(int is_move, apr_pool_t *p, const dav_resource *src, const dav_resource *dst, dav_buffer *pbuf)
static dav_error * dav_fs_copymove_state(int is_move, apr_pool_t *p, const char *src_dir, const char *src_file, const char *dst_dir, const char *dst_file, dav_buffer *pbuf)
static const dav_hooks_liveprop dav_hooks_liveprop_fs
static dav_error * dav_fs_open_stream(const dav_resource *resource, dav_stream_mode mode, dav_stream **stream)
static apr_status_t tmpfile_cleanup(void *data)
static dav_error * dav_fs_copymove_file(int is_move, apr_pool_t *p, const char *src, const char *dst, const apr_finfo_t *src_finfo, const apr_finfo_t *dst_finfo, dav_buffer *pbuf)
static dav_error * dav_fs_create_collection(dav_resource *resource)
static dav_error * dav_fs_remove_resource(dav_resource *resource, dav_response **response)
static void dav_fs_patch_commit(const dav_resource *resource, int operation, void *context, dav_liveprop_rollback *rollback_ctx)
#define DAV_FS_COPY_BLOCKSIZE
Declarations for the filesystem repository implementation.
The representation of a filter chain.
struct apr_bucket_alloc_t * bucket_alloc
const dav_resource * root
const dav_resource * res_dst
dav_resource_private info2
const dav_walk_params * params
dav_resource_private info1
dav_resource_private * info
const dav_hooks_repository * hooks
const dav_resource * resource
A structure with the ingredients for a file based etag.
A structure that represents the current request.
abts_suite * testpath(abts_suite *suite)
apr_status_t apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, apr_dir_t *thedir)
apr_status_t apr_dir_make(const char *path, apr_fileperms_t perm, apr_pool_t *pool)
apr_status_t apr_dir_remove(const char *path, apr_pool_t *pool)
apr_status_t apr_dir_close(apr_dir_t *thedir)
apr_status_t apr_dir_open(apr_dir_t **new, const char *dirname, apr_pool_t *pool)