summaryrefslogtreecommitdiffstats
path: root/modules/dav/main/util.c
diff options
context:
space:
mode:
authorGreg Stein <gstein@apache.org>2001-01-26 12:44:51 +0100
committerGreg Stein <gstein@apache.org>2001-01-26 12:44:51 +0100
commit09fc5f8b63085efe065a60a1fc59c48940bb76cf (patch)
treec773474c1870107c636a64552861deeaeaaffd92 /modules/dav/main/util.c
parentapr_put_os_file() expected the caller to have an existing file or init to (diff)
downloadapache2-09fc5f8b63085efe065a60a1fc59c48940bb76cf.tar.xz
apache2-09fc5f8b63085efe065a60a1fc59c48940bb76cf.zip
Provide a way to allow get_resource and get_parent_resource to return errors
that might occur during the parsing of the URI and/or the lookup of the resource in the repository. Specifically: return a dav_error* and move the returned dav_resource* to an "out" parameter of the hook function. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87852 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/dav/main/util.c')
-rw-r--r--modules/dav/main/util.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/modules/dav/main/util.c b/modules/dav/main/util.c
index 9aa6a4f237..51ca37a343 100644
--- a/modules/dav/main/util.c
+++ b/modules/dav/main/util.c
@@ -1345,13 +1345,15 @@ dav_error * dav_validate_request(request_rec *r, dav_resource *resource,
/* (2) Validate the parent resource if requested */
if (err == NULL && (flags & DAV_VALIDATE_PARENT)) {
- dav_resource *parent_resource = (*repos_hooks->get_parent_resource)(resource);
+ dav_resource *parent_resource;
- if (parent_resource == NULL) {
+ err = (*repos_hooks->get_parent_resource)(resource, &parent_resource);
+
+ if (err == NULL && parent_resource == NULL) {
err = dav_new_error(r->pool, HTTP_FORBIDDEN, 0,
"Cannot access parent of repository root.");
}
- else {
+ else if (err == NULL) {
err = dav_validate_resource_state(r->pool, parent_resource, lockdb,
if_header,
flags | DAV_VALIDATE_IS_PARENT,
@@ -1603,7 +1605,12 @@ dav_error *dav_ensure_resource_writable(request_rec *r,
/* check parent resource if requested or if resource must be created */
if (!resource->exists || parent_only) {
- dav_resource *parent = (*resource->hooks->get_parent_resource)(resource);
+ dav_resource *parent;
+
+ if ((err = (*resource->hooks->get_parent_resource)(resource,
+ &parent)) != NULL)
+ return err;
+
if (parent == NULL || !parent->exists) {
body = apr_psprintf(r->pool,
"Missing one or more intermediate collections. "