You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by gs...@apache.org on 2002/01/25 00:11:27 UTC
cvs commit: httpd-2.0/modules/dav/fs dbm.c lock.c repos.c repos.h
gstein 02/01/24 15:11:27
Modified: modules/dav/fs dbm.c lock.c repos.c repos.h
Log:
Some extra tweaks to the DAV code file/path handling (to continue the
platforms fixes done by wrowe).
* dav_fs_get_parent_resource(): return NULL if we're at the root of
the URL (Location) space.
* dav_fs_dir_file_name(): make it return an error, in case we're
passed a bad path. adjusted callers [who just ignore it for now]
Revision Changes Path
1.22 +2 -1 httpd-2.0/modules/dav/fs/dbm.c
Index: dbm.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/dav/fs/dbm.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- dbm.c 21 Nov 2001 18:09:27 -0000 1.21
+++ dbm.c 24 Jan 2002 23:11:27 -0000 1.22
@@ -197,7 +197,8 @@
const char *pathname;
/* Get directory and filename for resource */
- dav_fs_dir_file_name(resource, &dirpath, &fname);
+ /* ### should test this result value... */
+ (void) dav_fs_dir_file_name(resource, &dirpath, &fname);
/* If not opening read-only, ensure the state dir exists */
if (!ro) {
1.23 +4 -2 httpd-2.0/modules/dav/fs/lock.c
Index: lock.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/dav/fs/lock.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- lock.c 24 Jan 2002 15:31:31 -0000 1.22
+++ lock.c 24 Jan 2002 23:11:27 -0000 1.23
@@ -992,7 +992,8 @@
{
const char *dirpath;
- dav_fs_dir_file_name(resource, &dirpath, NULL);
+ /* ### should test this result value... */
+ (void) dav_fs_dir_file_name(resource, &dirpath, NULL);
return dav_fs_load_locknull_list(dav_fs_pool(resource), dirpath, pbuf);
}
@@ -1008,7 +1009,8 @@
const char *fname;
dav_error *err;
- dav_fs_dir_file_name(resource, &dirpath, &fname);
+ /* ### should test this result value... */
+ (void) dav_fs_dir_file_name(resource, &dirpath, &fname);
if ((err = dav_fs_load_locknull_list(p, dirpath, &buf)) != NULL) {
return dav_push_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
1.62 +17 -6 httpd-2.0/modules/dav/fs/repos.c
Index: repos.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/dav/fs/repos.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- repos.c 24 Jan 2002 17:04:42 -0000 1.61
+++ repos.c 24 Jan 2002 23:11:27 -0000 1.62
@@ -235,7 +235,7 @@
return resource->info->pathname;
}
-void dav_fs_dir_file_name(
+dav_error * dav_fs_dir_file_name(
const dav_resource *resource,
const char **dirpath_p,
const char **fname_p)
@@ -283,10 +283,13 @@
*fname_p = ctx->pathname + dirlen;
}
else {
- if (fname_p != NULL)
- *fname_p = NULL;
+ return dav_new_error(ctx->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ "An incomplete/bad path was found in "
+ "dav_fs_dir_file_name.");
}
}
+
+ return NULL;
}
/* Note: picked up from ap_gm_timestr_822() */
@@ -530,8 +533,9 @@
dav_error *err;
/* Get directory and filename for resources */
- dav_fs_dir_file_name(src, &src_dir, &src_file);
- dav_fs_dir_file_name(dst, &dst_dir, &dst_file);
+ /* ### should test these result values... */
+ (void) dav_fs_dir_file_name(src, &src_dir, &src_file);
+ (void) dav_fs_dir_file_name(dst, &dst_dir, &dst_file);
/* Get the corresponding state files for each resource */
dav_dbm_get_statefiles(p, src_file, &src_state1, &src_state2);
@@ -582,7 +586,8 @@
apr_status_t status;
/* Get directory, filename, and state-file names for the resource */
- dav_fs_dir_file_name(resource, &dirpath, &fname);
+ /* ### should test this result value... */
+ (void) dav_fs_dir_file_name(resource, &dirpath, &fname);
dav_dbm_get_statefiles(p, fname, &state1, &state2);
/* build the propset pathname for the file */
@@ -741,6 +746,12 @@
char *dirpath;
const char *testroot;
const char *testpath;
+
+ /* If we're at the root of the URL space, then there is no parent. */
+ if (strcmp(resource->uri, "/") == 0) {
+ *result_parent = NULL;
+ return NULL;
+ }
/* If given resource is root, then there is no parent.
* Unless we can retrieve the filepath root, this is
1.16 +3 -3 httpd-2.0/modules/dav/fs/repos.h
Index: repos.h
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/dav/fs/repos.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- repos.h 18 Sep 2001 03:55:41 -0000 1.15
+++ repos.h 24 Jan 2002 23:11:27 -0000 1.16
@@ -75,9 +75,9 @@
const char *dav_fs_pathname(const dav_resource *resource);
/* return the directory and filename for a resource */
-void dav_fs_dir_file_name(const dav_resource *resource,
- const char **dirpath,
- const char **fname);
+dav_error * dav_fs_dir_file_name(const dav_resource *resource,
+ const char **dirpath,
+ const char **fname);
/* return the list of locknull members in this resource's directory */
dav_error * dav_fs_get_locknull_members(const dav_resource *resource,