diff options
Diffstat (limited to 'www/mod_dav/files')
-rw-r--r-- | www/mod_dav/files/SYMLINK-dav_fs_repos.c | 218 | ||||
-rw-r--r-- | www/mod_dav/files/SYMLINK-mod_dav.h | 10 | ||||
-rw-r--r-- | www/mod_dav/files/apache.conf.mod_dav | 52 | ||||
-rw-r--r-- | www/mod_dav/files/patch-dav_fs_lock.c | 40 | ||||
-rw-r--r-- | www/mod_dav/files/pkg-install.in | 23 | ||||
-rw-r--r-- | www/mod_dav/files/pkg-message.in | 10 |
6 files changed, 0 insertions, 353 deletions
diff --git a/www/mod_dav/files/SYMLINK-dav_fs_repos.c b/www/mod_dav/files/SYMLINK-dav_fs_repos.c deleted file mode 100644 index fa5d5384f392..000000000000 --- a/www/mod_dav/files/SYMLINK-dav_fs_repos.c +++ /dev/null @@ -1,218 +0,0 @@ ---- dav_fs_repos.c.orig Mon Nov 5 16:20:32 2001 -+++ dav_fs_repos.c Tue Nov 11 14:14:11 2003 -@@ -154,6 +154,30 @@ - ** - ** PRIVATE REPOSITORY FUNCTIONS - */ -+ -+static int symlink_aware_rmdir(const char *pathname) -+{ -+ -+ struct stat finfo; -+ -+ /* Is this a symbolic link? */ -+ /* If not, just call rmdir() and return. */ -+ -+ if (lstat(pathname, &finfo) != 0) { -+ return -1; /* and errno set by lstat() */ -+ } -+ -+ if (!S_ISLNK(finfo.st_mode)) { -+ return rmdir(pathname); /* and errno set by rmdir() */ -+ } -+ -+ /* It's a symlink. */ -+ /* Remove the link itself, leaving the link's target untouched. */ -+ return unlink(pathname); /* and errno set by unlink() */ -+ -+} -+ -+ - pool *dav_fs_pool(const dav_resource *resource) - { - return resource->info->pool; -@@ -258,13 +282,25 @@ - /* chmod() the destination if the source is executable, and the - * destination already exists. */ - if ((mode & DAV_FS_MODE_XUSR) && (dst_finfo != NULL) && -- (dst_finfo->st_mode != 0)) { -+ (dst_finfo->st_mode != 0) && !S_ISLNK(dst_finfo->st_mode)) { - if (chmod(dst, mode) == -1) { - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not set permissions on destination"); - } - } - -+ /* If the destination is a symlink, break it so that we don't overwrite -+ * its target. */ -+ if ((dst_finfo != NULL) && S_ISLNK(dst_finfo->st_mode)) { -+ if (unlink(dst) != 0) { -+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, -+ "Could not break destination symlink"); -+ } -+ } -+ -+ -+ dav_set_bufsize(p, pbuf, DAV_FS_COPY_BLOCKSIZE); -+ - dav_set_bufsize(p, pbuf, DAV_FS_COPY_BLOCKSIZE); - - if ((fdi = open(src, O_RDONLY | O_BINARY)) == -1) { -@@ -565,8 +601,6 @@ - ctx->pool = r->pool; - ctx->finfo = r->finfo; - -- (void) ap_update_mtime(r, r->finfo.st_mtime); -- - /* Preserve case on OSes which fold canonical filenames */ - #if MODULE_MAGIC_NUMBER_MAJOR > 19990320 || (MODULE_MAGIC_NUMBER_MAJOR == 19990320 && MODULE_MAGIC_NUMBER_MINOR >= 8) - filename = r->case_preserved_filename; -@@ -606,9 +640,18 @@ - resource->uri = r->uri; - } - -- if (r->finfo.st_mode != 0) { -+ if (r->finfo.st_mode == 0) { -+ /* Apache says it does not exists. Is it maybe a dangling symlink? */ -+ if (lstat(ctx->pathname, &(ctx->finfo)) != 0) { -+ ctx->finfo.st_mode = 0; /* does not exist */ -+ } -+ } -+ -+ (void) ap_update_mtime(r, ctx->finfo.st_mtime); -+ -+ if (ctx->finfo.st_mode != 0) { - resource->exists = 1; -- resource->collection = S_ISDIR(r->finfo.st_mode); -+ resource->collection = S_ISDIR(ctx->finfo.st_mode); - - /* unused info in the URL will indicate a null resource */ - -@@ -979,7 +1022,7 @@ - * Note: when copying, we do not enable the postfix-traversal. - */ - /* ### we are ignoring any error here; what should we do? */ -- (void) rmdir(srcinfo->pathname); -+ (void) symlink_aware_rmdir(srcinfo->pathname); - } - else { - /* copy/move of a collection. Create the new, target collection */ -@@ -1157,6 +1200,15 @@ - } - } - -+ /* Renaming a symlink will only work in some circumstances (e.g., if -+ * old and new names are in the same directory). Be safe and break -+ * the link. -+ */ -+ if (S_ISLNK(srcinfo->finfo.st_mode)) { -+ can_rename = 0; -+ } -+ -+ - /* if we can't simply renamed, then do it the hard way... */ - if (!can_rename) { - if ((err = dav_fs_copymove_resource(1, src, dst, DAV_INFINITY, response)) == NULL) { -@@ -1226,8 +1278,31 @@ - - static dav_error * dav_fs_delete_walker(dav_walker_ctx *ctx, int calltype) - { -+ struct stat finfo; - dav_resource_private *info = ctx->resource->info; - -+ /* If this is a symlink to a directory, immediately remove the link -+ * during any "prefix traversal", then signal our caller, dav_fs_walker(), -+ * that we're done and not to follow the link to the target's children. -+ */ -+ if (ctx->resource->exists && ctx->resource->collection) { -+ if (lstat(info->pathname, &finfo) != 0) { -+ dav_add_response(ctx, ctx->resource->uri, HTTP_FORBIDDEN, NULL); -+ return NULL; /* failure */ -+ } -+ if (S_ISLNK(finfo.st_mode)) { -+ if (unlink(info->pathname) != 0) { -+ /* ### assume there is a permissions problem */ -+ /* ### use errno to generate DAV:responsedescription? */ -+ dav_add_response(ctx, ctx->resource->uri, HTTP_FORBIDDEN, NULL); -+ return NULL; /* failure */ -+ } -+ ctx->is_dir = 0; /* signal dav_fs_walker() that we're done */ -+ return NULL; /* success */ -+ } -+ } -+ -+ - /* do not attempt to remove a null resource, - * or a collection with children - */ -@@ -1237,7 +1312,7 @@ - int result; - - result = ctx->resource->collection -- ? rmdir(info->pathname) -+ ? symlink_aware_rmdir(info->pathname) - : remove(info->pathname); - - /* -@@ -1320,20 +1395,25 @@ - { - dav_error *err = NULL; - dav_walker_ctx *wctx = fsctx->wctx; -- int isdir = wctx->resource->collection; - DIR *dirp; - struct dirent *ep; - -- /* ensure the context is prepared properly, then call the func */ -+ /* ensure the context is prepared properly, then call the func. -+ * Note that if the resource is a symbolic link to a directory, -+ * and we should not recurse (for example, because we're deleting) -+ * func() will change wctx->is_dir to 0 to signal this. -+ */ -+ wctx->is_dir = wctx->resource->collection; - err = (*wctx->func)(wctx, -- isdir -+ wctx->is_dir - ? DAV_CALLTYPE_COLLECTION - : DAV_CALLTYPE_MEMBER); - if (err != NULL) { - return err; - } - -- if (!isdir) { -+ /* At this point, wctx->is_dir actually means "should we recurse?" */ -+ if (!wctx->is_dir) { - return NULL; - } - -@@ -1397,11 +1477,15 @@ - dav_buffer_place_mem(wctx->pool, - &fsctx->path1, ep->d_name, len + 1, 0); - -- if (lstat(fsctx->path1.buf, &fsctx->info1.finfo) != 0) { -- /* woah! where'd it go? */ -- /* ### should have a better error here */ -- err = dav_new_error(wctx->pool, HTTP_NOT_FOUND, 0, NULL); -- break; -+ /* stat() not lstat() because we want to follow symlinks */ -+ /* BUT, ignore dangling symlinks (symlinks whose targets don't exist) */ -+ if (stat(fsctx->path1.buf, &fsctx->info1.finfo) != 0) { -+ if (lstat(fsctx->path1.buf, &fsctx->info1.finfo) != 0) { -+ /* woah! where'd it go? */ -+ /* ### should have a better error here */ -+ err = dav_new_error(wctx->pool, HTTP_NOT_FOUND, 0, NULL); -+ break; -+ } - } - - /* copy the file to the URI, too. NOTE: we will pad an extra byte -@@ -1421,8 +1505,8 @@ - /* set up the URI for the current resource */ - fsctx->res1.uri = wctx->uri.buf; - -- /* ### for now, only process regular files (e.g. skip symlinks) */ -- if (S_ISREG(fsctx->info1.finfo.st_mode)) { -+ if (S_ISREG(fsctx->info1.finfo.st_mode) || -+ S_ISLNK(fsctx->info1.finfo.st_mode)) { - /* call the function for the specified dir + file */ - if ((err = (*wctx->func)(wctx, DAV_CALLTYPE_MEMBER)) != NULL) { - /* ### maybe add a higher-level description? */ diff --git a/www/mod_dav/files/SYMLINK-mod_dav.h b/www/mod_dav/files/SYMLINK-mod_dav.h deleted file mode 100644 index 0e16170bcac0..000000000000 --- a/www/mod_dav/files/SYMLINK-mod_dav.h +++ /dev/null @@ -1,10 +0,0 @@ ---- mod_dav.h.orig Tue Nov 11 14:16:48 2003 -+++ mod_dav.h Tue Nov 11 14:17:18 2003 -@@ -1431,6 +1431,7 @@ - - dav_text *propstat_404; /* (cached) propstat giving a 404 error */ - -+ int is_dir; /* state for dav_fs_walker(): should we recurse? */ - /* for COPY and MOVE operations */ - int is_move; - dav_buffer work_buf; diff --git a/www/mod_dav/files/apache.conf.mod_dav b/www/mod_dav/files/apache.conf.mod_dav deleted file mode 100644 index 382771181409..000000000000 --- a/www/mod_dav/files/apache.conf.mod_dav +++ /dev/null @@ -1,52 +0,0 @@ -### -### This file provides quick and dirty indications on how -### to set up the mod_dav module with apache. -### -### Please refer to the main web site for more information -### http://www.webdav.org/mod_dav/ -### - - -### -### This goes in the Global Environment section (Section 1) -### -### This should have been added automatically during the install process -### - -LoadModule dav_module libexec/apache/libdav.so - -AddModule mod_dav.c - - - - -### -### This goes in the main server configuration section (section 2) -### -### The lock database will have to be created in the /var/db directory -### to do so, just do (as root): -### # touch /var/db/DAVLock.dir -### # touch /var/db/DAVLock.pag -### # chown nobody.nobody /var/db/DAVLock.* -### # chmod 640 /var/db/DAVLock.* -### - -DAVLockDB /var/db/DAVLock -DAVMinTimeout 600 - - - -### -### This is an example of per location/directory configuration -### - -<Location /> - DAV On - AuthType Basic - AuthName DAV - AuthUserFile dav.passwd - <LimitExcept GET HEAD OPTIONS> - require user webadmin - </LimitExcept> -</Location> - diff --git a/www/mod_dav/files/patch-dav_fs_lock.c b/www/mod_dav/files/patch-dav_fs_lock.c deleted file mode 100644 index 5dcd52aa0a3d..000000000000 --- a/www/mod_dav/files/patch-dav_fs_lock.c +++ /dev/null @@ -1,40 +0,0 @@ ---- dav_fs_lock.c.orig Sat Dec 2 00:32:23 2000 -+++ dav_fs_lock.c Wed Sep 15 21:50:09 2004 -@@ -77,7 +77,7 @@ - ** INDIRECT LOCK: [char (DAV_LOCK_INDIRECT), - ** uuid_t locktoken, - ** time_t expires, --** int key_size, -+** size_t key_size, - ** char[] key] - ** The key is to the collection lock that resulted in this indirect lock - */ -@@ -166,7 +166,7 @@ - /* Stored indirect lock info - lock token and dav_datum */ - #define dav_size_indirect(a) (1 + sizeof(uuid_t) \ - + sizeof(time_t) \ -- + sizeof(int) + (a)->key.dsize) -+ + sizeof((a)->key.dsize) + (a)->key.dsize) - - /* - ** The lockdb structure. -@@ -1456,13 +1456,13 @@ - } - if (dav_fs_do_refresh(dp_scan, ltl, new_time)) { - /* the lock was refreshed. return the lock. */ -- newlock = dav_fs_alloc_lock(lockdb, ip->key, dp->locktoken); -+ newlock = dav_fs_alloc_lock(lockdb, ip->key, dp_scan->locktoken); - newlock->is_locknull = !resource->exists; -- newlock->scope = dp->f.scope; -- newlock->type = dp->f.type; -- newlock->depth = dp->f.depth; -- newlock->timeout = dp->f.timeout; -- newlock->owner = dp->owner; -+ newlock->scope = dp_scan->f.scope; -+ newlock->type = dp_scan->f.type; -+ newlock->depth = dp_scan->f.depth; -+ newlock->timeout = dp_scan->f.timeout; -+ newlock->owner = dp_scan->owner; - newlock->auth_user = dp_scan->auth_user; - - newlock->next = *locks; diff --git a/www/mod_dav/files/pkg-install.in b/www/mod_dav/files/pkg-install.in deleted file mode 100644 index e6e1d475e35d..000000000000 --- a/www/mod_dav/files/pkg-install.in +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -CHMOD=/bin/chmod -CHOWN=/usr/sbin/chown -TOUCH=/usr/bin/touch - -case $2 in -POST-INSTALL) - %%APXS%% -e -a -n dav libdav.so - for i in DAVLock.dir DAVLock.pag ; do - ${TOUCH} /var/db/$i - ${CHOWN} %%WWWOWN%%:%%WWWGRP%% /var/db/$i - ${CHMOD} 640 /var/db/$i - done - ;; -POST-DEINSTALL) - %%APXS%% -e -A -n dav libdav.so - for i in DAVLock.dir DAVLock.pag ; do - rm -f /var/db/$i - done - ;; -esac -exit 0 diff --git a/www/mod_dav/files/pkg-message.in b/www/mod_dav/files/pkg-message.in deleted file mode 100644 index 0b5dafa92c9a..000000000000 --- a/www/mod_dav/files/pkg-message.in +++ /dev/null @@ -1,10 +0,0 @@ -******************************************************* -* Please review the mod_dav configuration in the main -* Apache configuration file: -* %%PREFIX%%/etc/apache/httpd.conf -* -* Look at the file %%PREFIX%%/etc/apache/apache.conf.mod_dav -* for indications on what to do. The default lock database -* has already been created in /var/db/DAVLock.{dir,pag}. -* -******************************************************* |