You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2009/11/19 21:09:28 UTC
svn commit: r882274 - in /httpd/httpd/trunk: ./ include/ modules/dav/fs/
modules/dav/lock/ modules/dav/main/
Author: trawick
Date: Thu Nov 19 20:09:27 2009
New Revision: 882274
URL: http://svn.apache.org/viewvc?rev=882274&view=rev
Log:
Remove errno from dav_error interface. Calls to dav_new_error()
and dav_new_error_tag() must be adjusted to add an apr_status_t parameter.
Reviewed by: jorton
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/include/ap_mmn.h
httpd/httpd/trunk/modules/dav/fs/dbm.c
httpd/httpd/trunk/modules/dav/fs/lock.c
httpd/httpd/trunk/modules/dav/fs/repos.c
httpd/httpd/trunk/modules/dav/lock/locks.c
httpd/httpd/trunk/modules/dav/main/mod_dav.c
httpd/httpd/trunk/modules/dav/main/mod_dav.h
httpd/httpd/trunk/modules/dav/main/props.c
httpd/httpd/trunk/modules/dav/main/util.c
httpd/httpd/trunk/modules/dav/main/util_lock.c
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=882274&r1=882273&r2=882274&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Thu Nov 19 20:09:27 2009
@@ -10,6 +10,10 @@
mod_proxy_ftp: NULL pointer dereference on error paths.
[Stefan Fritsch <sf fritsch.de>, Joe Orton]
+ *) mod_dav: Remove errno from dav_error interface. Calls to dav_new_error()
+ and dav_new_error_tag() must be adjusted to add an apr_status_t parameter.
+ [Jeff Trawick]
+
*) mod_authnz_ldap: Add AuthLDAPBindAuthoritative to allow Authentication to
try other providers in the case of an LDAP bind failure.
PR 46608 [Justin Erenkrantz, Joe Schaefer, Tony Stevenson]
Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=882274&r1=882273&r2=882274&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Thu Nov 19 20:09:27 2009
@@ -204,6 +204,7 @@
* proxy_dir_conf
* 20091011.1 (2.3.3-dev) add debug_level to util_ldap_state_t
* 20091031.0 (2.3.3-dev) remove public LDAP referral-related macros
+ * 20091119.0 (2.3.4-dev) dav_error interface uses apr_status_t parm, not errno
*
*/
Modified: httpd/httpd/trunk/modules/dav/fs/dbm.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/fs/dbm.c?rev=882274&r1=882273&r2=882274&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/fs/dbm.c (original)
+++ httpd/httpd/trunk/modules/dav/fs/dbm.c Thu Nov 19 20:09:27 2009
@@ -79,7 +79,6 @@
static dav_error * dav_fs_dbm_error(dav_db *db, apr_pool_t *p,
apr_status_t status)
{
- int save_errno = errno;
int errcode;
const char *errstr;
dav_error *err;
@@ -100,8 +99,7 @@
errstr = apr_pstrdup(p, errbuf);
}
- err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, errcode, errstr);
- err->save_errno = save_errno;
+ err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, errcode, status, errstr);
return err;
}
@@ -419,7 +417,7 @@
/* call it a major version error */
return dav_new_error(pool, HTTP_INTERNAL_SERVER_ERROR,
- DAV_ERR_PROP_BAD_MAJOR,
+ DAV_ERR_PROP_BAD_MAJOR, 0,
"Prop database has the wrong major "
"version number and cannot be used.");
}
@@ -441,7 +439,7 @@
dav_dbm_close(db);
return dav_new_error(pool, HTTP_INTERNAL_SERVER_ERROR,
- DAV_ERR_PROP_BAD_MAJOR,
+ DAV_ERR_PROP_BAD_MAJOR, 0,
"Prop database has the wrong major "
"version number and cannot be used.");
}
Modified: httpd/httpd/trunk/modules/dav/fs/lock.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/fs/lock.c?rev=882274&r1=882273&r2=882274&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/fs/lock.c (original)
+++ httpd/httpd/trunk/modules/dav/fs/lock.c Thu Nov 19 20:09:27 2009
@@ -248,7 +248,7 @@
if (ap_strstr_c(char_token, "opaquelocktoken:") != char_token) {
return dav_new_error(p,
- HTTP_BAD_REQUEST, DAV_ERR_LOCK_UNK_STATE_TOKEN,
+ HTTP_BAD_REQUEST, DAV_ERR_LOCK_UNK_STATE_TOKEN, 0,
"The lock token uses an unknown State-token "
"format and could not be parsed.");
}
@@ -256,7 +256,7 @@
locktoken = apr_pcalloc(p, sizeof(*locktoken));
if (apr_uuid_parse(&locktoken->uuid, char_token)) {
- return dav_new_error(p, HTTP_BAD_REQUEST, DAV_ERR_LOCK_PARSE_TOKEN,
+ return dav_new_error(p, HTTP_BAD_REQUEST, DAV_ERR_LOCK_PARSE_TOKEN, 0,
"The opaquelocktoken has an incorrect format "
"and could not be parsed.");
}
@@ -345,7 +345,7 @@
comb->priv.lockdb_path = dav_get_lockdb_path(r);
if (comb->priv.lockdb_path == NULL) {
return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
- DAV_ERR_LOCK_NO_DB,
+ DAV_ERR_LOCK_NO_DB, 0,
"A lock database was not specified with the "
"DAVLockDB directive. One must be specified "
"to use the locking functionality.");
@@ -424,7 +424,7 @@
#if DAV_DEBUG
if (lockdb->ro) {
return dav_new_error(lockdb->info->pool,
- HTTP_INTERNAL_SERVER_ERROR, 0,
+ HTTP_INTERNAL_SERVER_ERROR, 0, 0,
"INTERNAL DESIGN ERROR: the lockdb was opened "
"readonly, but an attempt to save locks was "
"performed.");
@@ -637,7 +637,7 @@
--offset;
return dav_new_error(p,
HTTP_INTERNAL_SERVER_ERROR,
- DAV_ERR_LOCK_CORRUPT_DB,
+ DAV_ERR_LOCK_CORRUPT_DB, 0,
apr_psprintf(p,
"The lock database was found to "
"be corrupt. offset %"
@@ -694,7 +694,7 @@
/* ### use a different description and/or error ID? */
return dav_new_error(lockdb->info->pool,
HTTP_INTERNAL_SERVER_ERROR,
- DAV_ERR_LOCK_CORRUPT_DB,
+ DAV_ERR_LOCK_CORRUPT_DB, 0,
"The lock database was found to be corrupt. "
"An indirect lock's direct lock could not "
"be found.");
@@ -768,7 +768,7 @@
rv = apr_file_info_get(&finfo, APR_FINFO_SIZE, file);
if (rv != APR_SUCCESS) {
- err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, rv,
apr_psprintf(p,
"Opened but could not stat file %s",
pbuf->buf));
@@ -776,7 +776,7 @@
}
if (finfo.size != (apr_size_t)finfo.size) {
- err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
apr_psprintf(p,
"Opened but rejected huge file %s",
pbuf->buf));
@@ -785,9 +785,9 @@
amt = (apr_size_t)finfo.size;
dav_set_bufsize(p, pbuf, amt);
- if (apr_file_read(file, pbuf->buf, &amt) != APR_SUCCESS
+ if ((rv = apr_file_read(file, pbuf->buf, &amt)) != APR_SUCCESS
|| amt != finfo.size) {
- err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, rv,
apr_psprintf(p,
"Failure reading locknull file "
"for %s", dirpath));
@@ -813,6 +813,7 @@
apr_file_t *file = NULL;
dav_error *err = NULL;
apr_size_t amt;
+ apr_status_t rv;
if (pbuf->buf == NULL)
return NULL;
@@ -826,27 +827,27 @@
if (pbuf->cur_len == 0) {
/* delete the file if cur_len == 0 */
- if (apr_file_remove(pathname, p) != 0) {
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ if ((rv = apr_file_remove(pathname, p)) != APR_SUCCESS) {
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, rv,
apr_psprintf(p,
"Error removing %s", pathname));
}
return NULL;
}
- if (apr_file_open(&file, pathname,
- APR_WRITE | APR_CREATE | APR_TRUNCATE | APR_BINARY,
- APR_OS_DEFAULT, p) != APR_SUCCESS) {
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ if ((rv = apr_file_open(&file, pathname,
+ APR_WRITE | APR_CREATE | APR_TRUNCATE | APR_BINARY,
+ APR_OS_DEFAULT, p)) != APR_SUCCESS) {
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, rv,
apr_psprintf(p,
"Error opening %s for writing",
pathname));
}
amt = pbuf->cur_len;
- if (apr_file_write(file, pbuf->buf, &amt) != APR_SUCCESS
+ if ((rv = apr_file_write(file, pbuf->buf, &amt)) != APR_SUCCESS
|| amt != pbuf->cur_len) {
- err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, rv,
apr_psprintf(p,
"Error writing %" APR_SIZE_T_FMT
" bytes to %s",
@@ -1005,7 +1006,7 @@
#if DAV_DEBUG
if (calltype == DAV_GETLOCKS_COMPLETE) {
return dav_new_error(lockdb->info->pool,
- HTTP_INTERNAL_SERVER_ERROR, 0,
+ HTTP_INTERNAL_SERVER_ERROR, 0, 0,
"INTERNAL DESIGN ERROR: DAV_GETLOCKS_COMPLETE "
"is not yet supported");
}
Modified: httpd/httpd/trunk/modules/dav/fs/repos.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/fs/repos.c?rev=882274&r1=882273&r2=882274&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/fs/repos.c (original)
+++ httpd/httpd/trunk/modules/dav/fs/repos.c Thu Nov 19 20:09:27 2009
@@ -282,7 +282,7 @@
*fname_p = ctx->pathname + dirlen;
}
else {
- return dav_new_error(ctx->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(ctx->pool, HTTP_INTERNAL_SERVER_ERROR, 0, rv,
"An incomplete/bad path was found in "
"dav_fs_dir_file_name.");
}
@@ -349,8 +349,8 @@
if (dst_finfo != NULL) {
/* chmod it if it already exist */
- if (apr_file_perms_set(dst, perms)) {
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ if ((status = apr_file_perms_set(dst, perms)) != APR_SUCCESS) {
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, status,
"Could not set permissions on destination");
}
}
@@ -361,10 +361,10 @@
dav_set_bufsize(p, pbuf, DAV_FS_COPY_BLOCKSIZE);
- if ((apr_file_open(&inf, src, APR_READ | APR_BINARY, APR_OS_DEFAULT, p))
- != APR_SUCCESS) {
+ if ((status = apr_file_open(&inf, src, APR_READ | APR_BINARY,
+ APR_OS_DEFAULT, p)) != APR_SUCCESS) {
/* ### use something besides 500? */
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, status,
"Could not open file for reading");
}
@@ -374,7 +374,7 @@
if (status != APR_SUCCESS) {
apr_file_close(inf);
- return dav_new_error(p, MAP_IO2HTTP(status), 0,
+ return dav_new_error(p, MAP_IO2HTTP(status), 0, status,
"Could not open file for writing");
}
@@ -383,21 +383,24 @@
status = apr_file_read(inf, pbuf->buf, &len);
if (status != APR_SUCCESS && status != APR_EOF) {
+ apr_status_t lcl_status;
+
apr_file_close(inf);
apr_file_close(outf);
- if (apr_file_remove(dst, p) != APR_SUCCESS) {
+ if ((lcl_status = apr_file_remove(dst, p)) != APR_SUCCESS) {
/* ### ACK! Inconsistent state... */
/* ### use something besides 500? */
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ lcl_status,
"Could not delete output after read "
"failure. Server is now in an "
"inconsistent state.");
}
/* ### use something besides 500? */
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, status,
"Could not read input file");
}
@@ -407,20 +410,23 @@
/* write any bytes that were read */
status = apr_file_write_full(outf, pbuf->buf, len, NULL);
if (status != APR_SUCCESS) {
+ apr_status_t lcl_status;
+
apr_file_close(inf);
apr_file_close(outf);
- if (apr_file_remove(dst, p) != APR_SUCCESS) {
+ if ((lcl_status = apr_file_remove(dst, p)) != APR_SUCCESS) {
/* ### ACK! Inconsistent state... */
/* ### use something besides 500? */
return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ lcl_status,
"Could not delete output after write "
"failure. Server is now in an "
"inconsistent state.");
}
- return dav_new_error(p, MAP_IO2HTTP(status), 0,
+ return dav_new_error(p, MAP_IO2HTTP(status), 0, status,
"Could not write output file");
}
}
@@ -430,37 +436,34 @@
if (is_move && (status = apr_file_remove(src, p)) != APR_SUCCESS) {
dav_error *err;
- int save_errno = errno; /* save the errno that got us here */
+ apr_status_t lcl_status;
if (APR_STATUS_IS_ENOENT(status)) {
/*
* Something is wrong here but the result is what we wanted.
* We definitely should not remove the destination file.
*/
- err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, status,
apr_psprintf(p, "Could not remove source "
"file %s after move to %s. The "
"server may be in an "
"inconsistent state.", src, dst));
- err->save_errno = save_errno;
return err;
}
- else if (apr_file_remove(dst, p) != APR_SUCCESS) {
+ else if ((lcl_status = apr_file_remove(dst, p)) != APR_SUCCESS) {
/* ### ACK. this creates an inconsistency. do more!? */
/* ### use something besides 500? */
- /* Note that we use the latest errno */
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, lcl_status,
"Could not remove source or destination "
"file. Server is now in an inconsistent "
"state.");
}
/* ### use something besides 500? */
- err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, status,
"Could not remove source file after move. "
"Destination was removed to ensure consistency.");
- err->save_errno = save_errno;
return err;
}
@@ -501,7 +504,7 @@
if (rv != APR_SUCCESS) {
if (!APR_STATUS_IS_EEXIST(rv)) {
/* ### use something besides 500? */
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, rv,
"Could not create internal state directory");
}
}
@@ -511,7 +514,7 @@
if (rv != APR_SUCCESS && rv != APR_INCOMPLETE) {
/* Ack! Where'd it go? */
/* ### use something besides 500? */
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, rv,
"State directory disappeared");
}
@@ -519,7 +522,7 @@
if (dst_state_finfo.filetype != APR_DIR) {
/* ### try to recover by deleting this file? (and mkdir again) */
/* ### use something besides 500? */
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
"State directory is actually a file");
}
@@ -535,7 +538,7 @@
}
if (rv != APR_SUCCESS) {
/* ### use something besides 500? */
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, rv,
"Could not move state file.");
}
}
@@ -574,7 +577,7 @@
#if DAV_DEBUG
if ((src_state2 != NULL && dst_state2 == NULL) ||
(src_state2 == NULL && dst_state2 != NULL)) {
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
"DESIGN ERROR: dav_dbm_get_statefiles() "
"returned inconsistent results.");
}
@@ -631,7 +634,7 @@
/* note: we may get ENOENT if the state dir is not present */
if ((status = apr_file_remove(pathname, p)) != APR_SUCCESS
&& !APR_STATUS_IS_ENOENT(status)) {
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, status,
"Could not remove properties.");
}
@@ -646,7 +649,7 @@
if ((status = apr_file_remove(pathname, p)) != APR_SUCCESS
&& !APR_STATUS_IS_ENOENT(status)) {
/* ### CRAP. only removed half. */
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, status,
"Could not fully remove properties. "
"The server is now in an inconsistent "
"state.");
@@ -751,7 +754,7 @@
** be in path_info. The resource is simply an error: it
** can't be a null or a locknull resource.
*/
- return dav_new_error(r->pool, HTTP_BAD_REQUEST, 0,
+ return dav_new_error(r->pool, HTTP_BAD_REQUEST, 0, 0,
"The URL contains extraneous path "
"components. The resource could not "
"be identified.");
@@ -932,7 +935,7 @@
}
if (rv != APR_SUCCESS) {
- return dav_new_error(p, MAP_IO2HTTP(rv), 0,
+ return dav_new_error(p, MAP_IO2HTTP(rv), 0, rv,
"An error occurred while opening a resource.");
}
@@ -953,9 +956,11 @@
apr_pool_cleanup_run(stream->p, stream, tmpfile_cleanup);
}
else if (stream->unlink_on_error) {
- if (apr_file_remove(stream->pathname, stream->p) != APR_SUCCESS) {
+ if ((rv = apr_file_remove(stream->pathname, stream->p))
+ != APR_SUCCESS) {
/* ### use a better description? */
return dav_new_error(stream->p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ rv,
"There was a problem removing (rolling "
"back) the resource "
"when it was being closed.");
@@ -965,7 +970,7 @@
else if (stream->temppath) {
rv = apr_file_rename(stream->temppath, stream->pathname, stream->p);
if (rv) {
- return dav_new_error(stream->p, HTTP_INTERNAL_SERVER_ERROR, rv,
+ return dav_new_error(stream->p, HTTP_INTERNAL_SERVER_ERROR, 0, rv,
"There was a problem writing the file "
"atomically after writes.");
}
@@ -982,13 +987,13 @@
status = apr_file_write_full(stream->f, buf, bufsize, NULL);
if (APR_STATUS_IS_ENOSPC(status)) {
- return dav_new_error(stream->p, HTTP_INSUFFICIENT_STORAGE, 0,
+ return dav_new_error(stream->p, HTTP_INSUFFICIENT_STORAGE, 0, status,
"There is not enough storage to write to "
"this resource.");
}
else if (status != APR_SUCCESS) {
/* ### use something besides 500? */
- return dav_new_error(stream->p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(stream->p, HTTP_INTERNAL_SERVER_ERROR, 0, status,
"An error occurred while writing to a "
"resource.");
}
@@ -997,11 +1002,14 @@
static dav_error * dav_fs_seek_stream(dav_stream *stream, apr_off_t abs_pos)
{
- if (apr_file_seek(stream->f, APR_SET, &abs_pos) != APR_SUCCESS) {
+ apr_status_t status;
+
+ if ((status = apr_file_seek(stream->f, APR_SET, &abs_pos))
+ != APR_SUCCESS) {
/* ### should check whether apr_file_seek set abs_pos was set to the
* correct position? */
/* ### use something besides 500? */
- return dav_new_error(stream->p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(stream->p, HTTP_INTERNAL_SERVER_ERROR, 0, status,
"Could not seek to specified position in the "
"resource.");
}
@@ -1053,11 +1061,11 @@
if (resource->type != DAV_RESOURCE_TYPE_REGULAR
&& resource->type != DAV_RESOURCE_TYPE_VERSION
&& resource->type != DAV_RESOURCE_TYPE_WORKING) {
- return dav_new_error(pool, HTTP_CONFLICT, 0,
+ return dav_new_error(pool, HTTP_CONFLICT, 0, 0,
"Cannot GET this type of resource.");
}
if (resource->collection) {
- return dav_new_error(pool, HTTP_CONFLICT, 0,
+ return dav_new_error(pool, HTTP_CONFLICT, 0, 0,
"There is no default response to GET for a "
"collection.");
}
@@ -1065,7 +1073,7 @@
if ((status = apr_file_open(&fd, resource->info->pathname,
APR_READ | APR_BINARY, 0,
pool)) != APR_SUCCESS) {
- return dav_new_error(pool, HTTP_FORBIDDEN, 0,
+ return dav_new_error(pool, HTTP_FORBIDDEN, 0, status,
"File permissions deny server access.");
}
@@ -1077,7 +1085,7 @@
APR_BRIGADE_INSERT_TAIL(bb, bkt);
if ((status = ap_pass_brigade(output, bb)) != APR_SUCCESS) {
- return dav_new_error(pool, HTTP_FORBIDDEN, 0,
+ return dav_new_error(pool, HTTP_FORBIDDEN, 0, status,
"Could not write contents to filter.");
}
@@ -1094,18 +1102,18 @@
status = apr_dir_make(ctx->pathname, APR_OS_DEFAULT, ctx->pool);
if (APR_STATUS_IS_ENOSPC(status)) {
- return dav_new_error(ctx->pool, HTTP_INSUFFICIENT_STORAGE, 0,
+ return dav_new_error(ctx->pool, HTTP_INSUFFICIENT_STORAGE, 0, status,
"There is not enough storage to create "
"this collection.");
}
else if (APR_STATUS_IS_ENOENT(status)) {
- return dav_new_error(ctx->pool, HTTP_CONFLICT, 0,
+ return dav_new_error(ctx->pool, HTTP_CONFLICT, 0, status,
"Cannot create collection; intermediate "
"collection does not exist.");
}
else if (status != APR_SUCCESS) {
/* ### refine this error message? */
- return dav_new_error(ctx->pool, HTTP_FORBIDDEN, 0,
+ return dav_new_error(ctx->pool, HTTP_FORBIDDEN, 0, status,
"Unable to create collection.");
}
@@ -1119,6 +1127,7 @@
static dav_error * dav_fs_copymove_walker(dav_walk_resource *wres,
int calltype)
{
+ apr_status_t status;
dav_fs_copymove_walk_ctx *ctx = wres->walk_ctx;
dav_resource_private *srcinfo = wres->resource->info;
dav_resource_private *dstinfo = ctx->res_dst->info;
@@ -1134,11 +1143,11 @@
}
else {
/* copy/move of a collection. Create the new, target collection */
- if (apr_dir_make(dstinfo->pathname, APR_OS_DEFAULT,
- ctx->pool) != APR_SUCCESS) {
+ if ((status = apr_dir_make(dstinfo->pathname, APR_OS_DEFAULT,
+ ctx->pool)) != APR_SUCCESS) {
/* ### assume it was a permissions problem */
/* ### need a description here */
- err = dav_new_error(ctx->pool, HTTP_FORBIDDEN, 0, NULL);
+ err = dav_new_error(ctx->pool, HTTP_FORBIDDEN, 0, status, NULL);
}
}
}
@@ -1217,7 +1226,7 @@
if ((*response = multi_status) != NULL) {
/* some multistatus responses exist. wrap them in a 207 */
- return dav_new_error(src->info->pool, HTTP_MULTI_STATUS, 0,
+ return dav_new_error(src->info->pool, HTTP_MULTI_STATUS, 0, 0,
"Error(s) occurred on some resources during "
"the COPY/MOVE process.");
}
@@ -1253,7 +1262,7 @@
** ### strictly speaking, this is a design error; we should not
** ### have reached this point.
*/
- return dav_new_error(src->info->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(src->info->pool, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
"DESIGN ERROR: a mix of repositories "
"was passed to copy_resource.");
}
@@ -1286,7 +1295,7 @@
** ### strictly speaking, this is a design error; we should not
** ### have reached this point.
*/
- return dav_new_error(src->info->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(src->info->pool, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
"DESIGN ERROR: a mix of repositories "
"was passed to move_resource.");
}
@@ -1315,7 +1324,7 @@
if (rv != APR_SUCCESS) {
/* ### should have a better error than this. */
- return dav_new_error(srcinfo->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(srcinfo->pool, HTTP_INTERNAL_SERVER_ERROR, 0, rv,
"Could not rename resource.");
}
@@ -1400,6 +1409,7 @@
static dav_error * dav_fs_remove_resource(dav_resource *resource,
dav_response **response)
{
+ apr_status_t status;
dav_resource_private *info = resource->info;
*response = NULL;
@@ -1427,7 +1437,7 @@
if ((*response = multi_status) != NULL) {
/* some multistatus responses exist. wrap them in a 207 */
- return dav_new_error(info->pool, HTTP_MULTI_STATUS, 0,
+ return dav_new_error(info->pool, HTTP_MULTI_STATUS, 0, 0,
"Error(s) occurred on some resources during "
"the deletion process.");
}
@@ -1440,9 +1450,9 @@
}
/* not a collection; remove the file and its properties */
- if (apr_file_remove(info->pathname, info->pool) != APR_SUCCESS) {
+ if ((status = apr_file_remove(info->pathname, info->pool)) != APR_SUCCESS) {
/* ### put a description in here */
- return dav_new_error(info->pool, HTTP_FORBIDDEN, 0, NULL);
+ return dav_new_error(info->pool, HTTP_FORBIDDEN, 0, status, NULL);
}
/* update resource state */
@@ -1460,6 +1470,7 @@
{
const dav_walk_params *params = fsctx->params;
apr_pool_t *pool = params->pool;
+ apr_status_t status;
dav_error *err = NULL;
int isdir = fsctx->res1.collection;
apr_finfo_t dirent;
@@ -1501,13 +1512,12 @@
fsctx->res2.collection = 0;
/* open and scan the directory */
- if ((apr_dir_open(&dirp, fsctx->path1.buf, pool)) != APR_SUCCESS) {
+ if ((status = apr_dir_open(&dirp, fsctx->path1.buf, pool)) != APR_SUCCESS) {
/* ### need a better error */
- return dav_new_error(pool, HTTP_NOT_FOUND, 0, NULL);
+ return dav_new_error(pool, HTTP_NOT_FOUND, 0, status, NULL);
}
while ((apr_dir_read(&dirent, APR_FINFO_DIRENT, dirp)) == APR_SUCCESS) {
apr_size_t len;
- apr_status_t status;
len = strlen(dirent.name);
@@ -1544,7 +1554,7 @@
if (status != APR_SUCCESS && status != APR_INCOMPLETE) {
/* woah! where'd it go? */
/* ### should have a better error here */
- err = dav_new_error(pool, HTTP_NOT_FOUND, 0, NULL);
+ err = dav_new_error(pool, HTTP_NOT_FOUND, 0, status, NULL);
break;
}
@@ -1744,7 +1754,7 @@
#if DAV_DEBUG
if ((params->walk_type & DAV_WALKTYPE_LOCKNULL) != 0
&& params->lockdb == NULL) {
- return dav_new_error(params->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(params->pool, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
"DESIGN ERROR: walker called to walk locknull "
"resources, but a lockdb was not provided.");
}
@@ -2015,7 +2025,7 @@
}
if (operation == DAV_PROP_OP_DELETE) {
- return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0,
+ return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0, 0,
"The 'executable' property cannot be removed.");
}
@@ -2030,7 +2040,7 @@
if (cdata == NULL) {
if (f_cdata == NULL) {
- return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0,
+ return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0, 0,
"The 'executable' property expects a single "
"character, valued 'T' or 'F'. There was no "
"value submitted.");
@@ -2045,7 +2055,7 @@
value = cdata->text[0];
if (value != 'T' && value != 'F') {
- return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0,
+ return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0, 0,
"The 'executable' property expects a single "
"character, valued 'T' or 'F'. The value "
"submitted is invalid.");
@@ -2056,7 +2066,7 @@
return NULL;
too_long:
- return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0,
+ return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0, 0,
"The 'executable' property expects a single "
"character, valued 'T' or 'F'. The value submitted "
"has too many characters.");
@@ -2071,6 +2081,7 @@
{
long value = context != NULL;
apr_fileperms_t perms = resource->info->finfo.protection;
+ apr_status_t status;
long old_value = (perms & APR_UEXECUTE) != 0;
/* assert: prop == executable. operation == SET. */
@@ -2084,9 +2095,10 @@
if (value)
perms |= APR_UEXECUTE;
- if (apr_file_perms_set(resource->info->pathname, perms) != APR_SUCCESS) {
+ if ((status = apr_file_perms_set(resource->info->pathname, perms))
+ != APR_SUCCESS) {
return dav_new_error(resource->info->pool,
- HTTP_INTERNAL_SERVER_ERROR, 0,
+ HTTP_INTERNAL_SERVER_ERROR, 0, status,
"Could not set the executable flag of the "
"target resource.");
}
@@ -2112,6 +2124,7 @@
dav_liveprop_rollback *rollback_ctx)
{
apr_fileperms_t perms = resource->info->finfo.protection & ~APR_UEXECUTE;
+ apr_status_t status;
int value = rollback_ctx != NULL;
/* assert: prop == executable. operation == SET. */
@@ -2120,9 +2133,10 @@
if (value)
perms |= APR_UEXECUTE;
- if (apr_file_perms_set(resource->info->pathname, perms) != APR_SUCCESS) {
+ if ((status = apr_file_perms_set(resource->info->pathname, perms))
+ != APR_SUCCESS) {
return dav_new_error(resource->info->pool,
- HTTP_INTERNAL_SERVER_ERROR, 0,
+ HTTP_INTERNAL_SERVER_ERROR, 0, status,
"After a failure occurred, the resource's "
"executable flag could not be restored.");
}
Modified: httpd/httpd/trunk/modules/dav/lock/locks.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/lock/locks.c?rev=882274&r1=882273&r2=882274&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/lock/locks.c (original)
+++ httpd/httpd/trunk/modules/dav/lock/locks.c Thu Nov 19 20:09:27 2009
@@ -204,7 +204,6 @@
static dav_error * dav_generic_dbm_new_error(apr_dbm_t *db, apr_pool_t *p,
apr_status_t status)
{
- int save_errno = errno;
int errcode;
const char *errstr;
dav_error *err;
@@ -224,8 +223,7 @@
errstr = apr_pstrdup(p, errbuf);
}
- err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, errcode, errstr);
- err->save_errno = save_errno;
+ err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, errcode, status, errstr);
return err;
}
@@ -264,7 +262,7 @@
if (ap_strstr_c(char_token, "opaquelocktoken:") != char_token) {
return dav_new_error(p,
- HTTP_BAD_REQUEST, DAV_ERR_LOCK_UNK_STATE_TOKEN,
+ HTTP_BAD_REQUEST, DAV_ERR_LOCK_UNK_STATE_TOKEN, 0,
"The lock token uses an unknown State-token "
"format and could not be parsed.");
}
@@ -272,7 +270,7 @@
locktoken = apr_pcalloc(p, sizeof(*locktoken));
if (apr_uuid_parse(&locktoken->uuid, char_token)) {
- return dav_new_error(p, HTTP_BAD_REQUEST, DAV_ERR_LOCK_PARSE_TOKEN,
+ return dav_new_error(p, HTTP_BAD_REQUEST, DAV_ERR_LOCK_PARSE_TOKEN, 0,
"The opaquelocktoken has an incorrect format "
"and could not be parsed.");
}
@@ -363,7 +361,7 @@
comb->priv.lockdb_path = dav_generic_get_lockdb_path(r);
if (comb->priv.lockdb_path == NULL) {
return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
- DAV_ERR_LOCK_NO_DB,
+ DAV_ERR_LOCK_NO_DB, 0,
"A lock database was not specified with the "
"DAVGenericLockDB directive. One must be "
"specified to use the locking functionality.");
@@ -447,7 +445,7 @@
#if DAV_DEBUG
if (lockdb->ro) {
return dav_new_error(lockdb->info->pool,
- HTTP_INTERNAL_SERVER_ERROR, 0,
+ HTTP_INTERNAL_SERVER_ERROR, 0, 0,
"INTERNAL DESIGN ERROR: the lockdb was opened "
"readonly, but an attempt to save locks was "
"performed.");
@@ -665,7 +663,7 @@
--offset;
return dav_new_error(p,
HTTP_INTERNAL_SERVER_ERROR,
- DAV_ERR_LOCK_CORRUPT_DB,
+ DAV_ERR_LOCK_CORRUPT_DB, 0,
apr_psprintf(p,
"The lock database was found to "
"be corrupt. offset %"
@@ -722,7 +720,7 @@
/* ### use a different description and/or error ID? */
return dav_new_error(lockdb->info->pool,
HTTP_INTERNAL_SERVER_ERROR,
- DAV_ERR_LOCK_CORRUPT_DB,
+ DAV_ERR_LOCK_CORRUPT_DB, 0,
"The lock database was found to be corrupt. "
"An indirect lock's direct lock could not "
"be found.");
@@ -798,7 +796,7 @@
#if DAV_DEBUG
if (calltype == DAV_GETLOCKS_COMPLETE) {
return dav_new_error(lockdb->info->pool,
- HTTP_INTERNAL_SERVER_ERROR, 0,
+ HTTP_INTERNAL_SERVER_ERROR, 0, 0,
"INTERNAL DESIGN ERROR: DAV_GETLOCKS_COMPLETE "
"is not yet supported");
}
Modified: httpd/httpd/trunk/modules/dav/main/mod_dav.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/main/mod_dav.c?rev=882274&r1=882273&r2=882274&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/main/mod_dav.c (original)
+++ httpd/httpd/trunk/modules/dav/main/mod_dav.c Thu Nov 19 20:09:27 2009
@@ -557,16 +557,8 @@
if (errscan->desc == NULL)
continue;
- if (errscan->save_errno != 0) {
- errno = errscan->save_errno;
- ap_log_rerror(APLOG_MARK, level, errno, r, "%s [%d, #%d]",
- errscan->desc, errscan->status, errscan->error_id);
- }
- else {
- ap_log_rerror(APLOG_MARK, level, 0, r,
- "%s [%d, #%d]",
- errscan->desc, errscan->status, errscan->error_id);
- }
+ ap_log_rerror(APLOG_MARK, level, errscan->aprerr, r, "%s [%d, #%d]",
+ errscan->desc, errscan->status, errscan->error_id);
}
}
@@ -729,7 +721,7 @@
/* Note: this shouldn't happen, but just be sure... */
if (*res_p == NULL) {
/* ### maybe use HTTP_INTERNAL_SERVER_ERROR */
- return dav_new_error(r->pool, HTTP_NOT_FOUND, 0,
+ return dav_new_error(r->pool, HTTP_NOT_FOUND, 0, 0,
apr_psprintf(r->pool,
"The provider did not define a "
"resource for %s.",
@@ -981,7 +973,7 @@
APR_BLOCK_READ, DAV_READ_BLOCKSIZE);
if (rc != APR_SUCCESS) {
- err = dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ err = dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, rc,
apr_psprintf(r->pool,
"Could not get next bucket "
"brigade (URI: %s)",
@@ -1007,7 +999,7 @@
rc = apr_bucket_read(b, &data, &len, APR_BLOCK_READ);
if (rc != APR_SUCCESS) {
- err = dav_new_error(r->pool, HTTP_BAD_REQUEST, 0,
+ err = dav_new_error(r->pool, HTTP_BAD_REQUEST, 0, rc,
apr_psprintf(r->pool,
"An error occurred while reading"
" the request body (URI: %s)",
@@ -1298,7 +1290,7 @@
}
if (name == NULL) {
- return dav_new_error(r->pool, HTTP_BAD_REQUEST, 0,
+ return dav_new_error(r->pool, HTTP_BAD_REQUEST, 0, 0,
"A DAV:supported-method element "
"does not have a \"name\" attribute");
}
@@ -1381,7 +1373,7 @@
}
if (name == NULL) {
- err = dav_new_error(r->pool, HTTP_BAD_REQUEST, 0,
+ err = dav_new_error(r->pool, HTTP_BAD_REQUEST, 0, 0,
"A DAV:supported-live-property "
"element does not have a \"name\" "
"attribute");
@@ -1466,7 +1458,7 @@
}
if (name == NULL) {
- return dav_new_error(r->pool, HTTP_BAD_REQUEST, 0,
+ return dav_new_error(r->pool, HTTP_BAD_REQUEST, 0, 0,
"A DAV:supported-report element "
"does not have a \"name\" attribute");
}
@@ -2150,7 +2142,7 @@
if (ctx->operation == DAV_PROP_OP_SET) {
if (err424_set == NULL)
- err424_set = dav_new_error(p, HTTP_FAILED_DEPENDENCY, 0,
+ err424_set = dav_new_error(p, HTTP_FAILED_DEPENDENCY, 0, 0,
"Attempted DAV:set operation "
"could not be completed due "
"to other errors.");
@@ -2158,7 +2150,7 @@
}
else if (ctx->operation == DAV_PROP_OP_DELETE) {
if (err424_delete == NULL)
- err424_delete = dav_new_error(p, HTTP_FAILED_DEPENDENCY, 0,
+ err424_delete = dav_new_error(p, HTTP_FAILED_DEPENDENCY, 0, 0,
"Attempted DAV:remove "
"operation could not be "
"completed due to other "
@@ -3038,7 +3030,7 @@
return dav_handle_err(r, err, NULL);
}
if (parent && (!parent->exists || parent->collection != 1)) {
- err = dav_new_error(r->pool, HTTP_CONFLICT, 0,
+ err = dav_new_error(r->pool, HTTP_CONFLICT, 0, 0,
apr_psprintf(r->pool,
"The parent resource of %s does not "
"exist or is not a collection.",
@@ -3343,14 +3335,14 @@
/* if not versioning existing resource, must specify version to select */
if (!resource->exists && target == NULL) {
- err = dav_new_error(r->pool, HTTP_CONFLICT, 0,
+ err = dav_new_error(r->pool, HTTP_CONFLICT, 0, 0,
"<DAV:initial-version-required/>");
return dav_handle_err(r, err, NULL);
}
else if (resource->exists) {
/* cannot add resource to existing version history */
if (target != NULL) {
- err = dav_new_error(r->pool, HTTP_CONFLICT, 0,
+ err = dav_new_error(r->pool, HTTP_CONFLICT, 0, 0,
"<DAV:cannot-add-to-existing-history/>");
return dav_handle_err(r, err, NULL);
}
@@ -3358,7 +3350,7 @@
/* resource must be unversioned and versionable, or version selector */
if (resource->type != DAV_RESOURCE_TYPE_REGULAR
|| (!resource->versioned && !(vsn_hooks->versionable)(resource))) {
- err = dav_new_error(r->pool, HTTP_CONFLICT, 0,
+ err = dav_new_error(r->pool, HTTP_CONFLICT, 0, 0,
"<DAV:must-be-versionable/>");
return dav_handle_err(r, err, NULL);
}
@@ -3919,11 +3911,11 @@
if (wres->resource->type != DAV_RESOURCE_TYPE_VERSION &&
(wres->resource->type != DAV_RESOURCE_TYPE_REGULAR
|| !wres->resource->versioned)) {
- err = dav_new_error(ctx->w.pool, HTTP_CONFLICT, 0,
+ err = dav_new_error(ctx->w.pool, HTTP_CONFLICT, 0, 0,
"<DAV:must-be-version-or-version-selector/>");
}
else if (wres->resource->working) {
- err = dav_new_error(ctx->w.pool, HTTP_CONFLICT, 0,
+ err = dav_new_error(ctx->w.pool, HTTP_CONFLICT, 0, 0,
"<DAV:must-not-be-checked-out/>");
}
else {
@@ -4049,11 +4041,12 @@
* overall error to pass to dav_handle_err()
*/
if (depth == 0) {
- err = dav_new_error(r->pool, multi_status->status, 0, multi_status->desc);
+ err = dav_new_error(r->pool, multi_status->status, 0, 0,
+ multi_status->desc);
multi_status = NULL;
}
else {
- err = dav_new_error(r->pool, HTTP_MULTI_STATUS, 0,
+ err = dav_new_error(r->pool, HTTP_MULTI_STATUS, 0, 0,
"Errors occurred during the LABEL operation.");
}
@@ -4175,7 +4168,7 @@
/* resource must not already exist */
if (resource->exists) {
- err = dav_new_error(r->pool, HTTP_CONFLICT, 0,
+ err = dav_new_error(r->pool, HTTP_CONFLICT, 0, 0,
"<DAV:resource-must-be-null/>");
return dav_handle_err(r, err, NULL);
}
@@ -4231,7 +4224,7 @@
/* resource must not already exist */
if (resource->exists) {
- err = dav_new_error(r->pool, HTTP_CONFLICT, 0,
+ err = dav_new_error(r->pool, HTTP_CONFLICT, 0, 0,
"<DAV:resource-must-be-null/>");
return dav_handle_err(r, err, NULL);
}
@@ -4240,7 +4233,7 @@
an activity, i.e. whether the location is ok. */
if (vsn_hooks->can_be_activity != NULL
&& !(*vsn_hooks->can_be_activity)(resource)) {
- err = dav_new_error(r->pool, HTTP_FORBIDDEN, 0,
+ err = dav_new_error(r->pool, HTTP_FORBIDDEN, 0, 0,
"<DAV:activity-location-ok/>");
return dav_handle_err(r, err, NULL);
}
Modified: httpd/httpd/trunk/modules/dav/main/mod_dav.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/main/mod_dav.h?rev=882274&r1=882273&r2=882274&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/main/mod_dav.h (original)
+++ httpd/httpd/trunk/modules/dav/main/mod_dav.h Thu Nov 19 20:09:27 2009
@@ -123,7 +123,7 @@
int error_id; /* DAV-specific error ID */
const char *desc; /* DAV:responsedescription and error log */
- int save_errno; /* copy of errno causing the error */
+ apr_status_t aprerr; /* APR error if any, or 0/APR_SUCCESS */
const char *namespace; /* [optional] namespace of error */
const char *tagname; /* name of error-tag */
@@ -137,16 +137,17 @@
** errno value.
*/
DAV_DECLARE(dav_error*) dav_new_error(apr_pool_t *p, int status,
- int error_id, const char *desc);
+ int error_id, apr_status_t aprerr,
+ const char *desc);
/*
** Create a new error structure with tagname and (optional) namespace;
-** namespace may be NULL, which means "DAV:". save_errno will be
-** filled with the current errno value.
+** namespace may be NULL, which means "DAV:".
*/
DAV_DECLARE(dav_error*) dav_new_error_tag(apr_pool_t *p, int status,
- int error_id, const char *desc,
+ int error_id, apr_status_t aprerr,
+ const char *desc,
const char *namespace,
const char *tagname);
Modified: httpd/httpd/trunk/modules/dav/main/props.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/main/props.c?rev=882274&r1=882273&r2=882274&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/main/props.c (original)
+++ httpd/httpd/trunk/modules/dav/main/props.c Thu Nov 19 20:09:27 2009
@@ -526,7 +526,7 @@
#if DAV_DEBUG
if (resource->uri == NULL) {
- return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
"INTERNAL DESIGN ERROR: resource must define "
"its URI.");
}
@@ -789,6 +789,7 @@
#if 0
/* ### need to change signature to return an error */
return dav_new_error(propdb->p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ 0,
"INTERNAL DESIGN ERROR: insert_liveprop "
"did not insert what was asked for.");
#endif
@@ -932,7 +933,7 @@
if (!dav_rw_liveprop(propdb, priv)) {
ctx->err = dav_new_error(propdb->p, HTTP_CONFLICT,
- DAV_ERR_PROP_READONLY,
+ DAV_ERR_PROP_READONLY, 0,
"Property is read-only.");
return;
}
@@ -968,7 +969,7 @@
*/
if (propdb->db == NULL) {
ctx->err = dav_new_error(propdb->p, HTTP_INTERNAL_SERVER_ERROR,
- DAV_ERR_PROP_NO_DATABASE,
+ DAV_ERR_PROP_NO_DATABASE, 0,
"Attempted to set/remove a property "
"without a valid, open, read/write "
"property database.");
Modified: httpd/httpd/trunk/modules/dav/main/util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/main/util.c?rev=882274&r1=882273&r2=882274&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/main/util.c (original)
+++ httpd/httpd/trunk/modules/dav/main/util.c Thu Nov 19 20:09:27 2009
@@ -33,10 +33,9 @@
#include "http_log.h"
#include "http_protocol.h"
-DAV_DECLARE(dav_error*) dav_new_error(apr_pool_t *p, int status,
- int error_id, const char *desc)
+DAV_DECLARE(dav_error*) dav_new_error(apr_pool_t *p, int status, int error_id,
+ apr_status_t aprerr, const char *desc)
{
- int save_errno = errno;
dav_error *err = apr_pcalloc(p, sizeof(*err));
/* DBG3("dav_new_error: %d %d %s", status, error_id, desc ? desc : "(no desc)"); */
@@ -44,17 +43,18 @@
err->status = status;
err->error_id = error_id;
err->desc = desc;
- err->save_errno = save_errno;
+ err->aprerr = aprerr;
return err;
}
DAV_DECLARE(dav_error*) dav_new_error_tag(apr_pool_t *p, int status,
- int error_id, const char *desc,
+ int error_id, apr_status_t aprerr,
+ const char *desc,
const char *namespace,
const char *tagname)
{
- dav_error *err = dav_new_error(p, status, error_id, desc);
+ dav_error *err = dav_new_error(p, status, error_id, aprerr, desc);
err->tagname = tagname;
err->namespace = namespace;
@@ -599,6 +599,7 @@
const char *state_token;
const char *uri = NULL; /* scope of current production; NULL=no-tag */
apr_size_t uri_len = 0;
+ apr_status_t rv;
dav_if_header *ih = NULL;
apr_uri_t parsed_uri;
const dav_hooks_locks *locks_hooks = DAV_GET_HOOKS_LOCKS(r);
@@ -617,16 +618,16 @@
if (list_type == no_tagged
|| ((uri = dav_fetch_next_token(&str, '>')) == NULL)) {
return dav_new_error(r->pool, HTTP_BAD_REQUEST,
- DAV_ERR_IF_TAGGED,
+ DAV_ERR_IF_TAGGED, 0,
"Invalid If-header: unclosed \"<\" or "
"unexpected tagged-list production.");
}
/* 2518 specifies this must be an absolute URI; just take the
* relative part for later comparison against r->uri */
- if (apr_uri_parse(r->pool, uri, &parsed_uri) != APR_SUCCESS) {
+ if ((rv = apr_uri_parse(r->pool, uri, &parsed_uri)) != APR_SUCCESS) {
return dav_new_error(r->pool, HTTP_BAD_REQUEST,
- DAV_ERR_IF_TAGGED,
+ DAV_ERR_IF_TAGGED, rv,
"Invalid URI in tagged If-header.");
}
/* note that parsed_uri.path is allocated; we can trash it */
@@ -650,14 +651,14 @@
if ((list = dav_fetch_next_token(&str, ')')) == NULL) {
return dav_new_error(r->pool, HTTP_BAD_REQUEST,
- DAV_ERR_IF_UNCLOSED_PAREN,
+ DAV_ERR_IF_UNCLOSED_PAREN, 0,
"Invalid If-header: unclosed \"(\".");
}
if ((ih = dav_add_if_resource(r->pool, ih, uri, uri_len)) == NULL) {
/* ### dav_add_if_resource() should return an error for us! */
return dav_new_error(r->pool, HTTP_BAD_REQUEST,
- DAV_ERR_IF_PARSE,
+ DAV_ERR_IF_PARSE, 0,
"Internal server error parsing \"If:\" "
"header.");
}
@@ -672,7 +673,7 @@
if ((state_token = dav_fetch_next_token(&list, '>')) == NULL) {
/* ### add a description to this error */
return dav_new_error(r->pool, HTTP_BAD_REQUEST,
- DAV_ERR_IF_PARSE, NULL);
+ DAV_ERR_IF_PARSE, 0, NULL);
}
if ((err = dav_add_if_state(r->pool, ih, state_token, dav_if_opaquelock,
@@ -687,7 +688,7 @@
if ((state_token = dav_fetch_next_token(&list, ']')) == NULL) {
/* ### add a description to this error */
return dav_new_error(r->pool, HTTP_BAD_REQUEST,
- DAV_ERR_IF_PARSE, NULL);
+ DAV_ERR_IF_PARSE, 0, NULL);
}
if ((err = dav_add_if_state(r->pool, ih, state_token, dav_if_etag,
@@ -702,7 +703,7 @@
if (list[1] == 'o' && list[2] == 't') {
if (condition != DAV_IF_COND_NORMAL) {
return dav_new_error(r->pool, HTTP_BAD_REQUEST,
- DAV_ERR_IF_MULTIPLE_NOT,
+ DAV_ERR_IF_MULTIPLE_NOT, 0,
"Invalid \"If:\" header: "
"Multiple \"not\" entries "
"for the same state.");
@@ -718,7 +719,7 @@
default:
return dav_new_error(r->pool, HTTP_BAD_REQUEST,
- DAV_ERR_IF_UNK_CHAR,
+ DAV_ERR_IF_UNK_CHAR, 0,
apr_psprintf(r->pool,
"Invalid \"If:\" "
"header: Unexpected "
@@ -737,7 +738,7 @@
default:
return dav_new_error(r->pool, HTTP_BAD_REQUEST,
- DAV_ERR_IF_UNK_CHAR,
+ DAV_ERR_IF_UNK_CHAR, 0,
apr_psprintf(r->pool,
"Invalid \"If:\" header: "
"Unexpected character "
@@ -883,7 +884,7 @@
*/
if (flags & DAV_LOCKSCOPE_EXCLUSIVE) {
if (lock_list != NULL) {
- return dav_new_error(p, HTTP_LOCKED, 0,
+ return dav_new_error(p, HTTP_LOCKED, 0, 0,
"Existing lock(s) on the requested resource "
"prevent an exclusive lock.");
}
@@ -901,7 +902,7 @@
*/
for (lock = lock_list; lock != NULL; lock = lock->next) {
if (lock->scope == DAV_LOCKSCOPE_EXCLUSIVE) {
- return dav_new_error(p, HTTP_LOCKED, 0,
+ return dav_new_error(p, HTTP_LOCKED, 0, 0,
"The requested resource is already "
"locked exclusively.");
}
@@ -940,7 +941,7 @@
if (seen_locktoken)
return NULL;
- return dav_new_error(p, HTTP_LOCKED, 0,
+ return dav_new_error(p, HTTP_LOCKED, 0, 0,
"This resource is locked and an \"If:\" header "
"was not supplied to allow access to the "
"resource.");
@@ -964,7 +965,7 @@
if (lock_list == NULL && if_header->dummy_header) {
if (flags & DAV_VALIDATE_IS_PARENT)
return NULL;
- return dav_new_error(p, HTTP_BAD_REQUEST, 0,
+ return dav_new_error(p, HTTP_BAD_REQUEST, 0, 0,
"The locktoken specified in the \"Lock-Token:\" "
"header is invalid because this resource has no "
"outstanding locks.");
@@ -1170,7 +1171,7 @@
"\" submitted a locktoken created "
"by user \"",
lock->auth_user, "\".", NULL);
- return dav_new_error(p, HTTP_FORBIDDEN, 0, errmsg);
+ return dav_new_error(p, HTTP_FORBIDDEN, 0, 0, errmsg);
}
/*
@@ -1290,7 +1291,7 @@
return NULL;
}
- return dav_new_error(p, HTTP_LOCKED, 0 /* error_id */,
+ return dav_new_error(p, HTTP_LOCKED, 0 /* error_id */, 0,
"This resource is locked and the \"If:\" "
"header did not specify one of the "
"locktokens for this resource's lock(s).");
@@ -1304,19 +1305,19 @@
** bad Lock-Token first. That is considered a 400 (Bad Request).
*/
if (if_header->dummy_header) {
- return dav_new_error(p, HTTP_BAD_REQUEST, 0,
+ return dav_new_error(p, HTTP_BAD_REQUEST, 0, 0,
"The locktoken specified in the "
"\"Lock-Token:\" header did not specify one "
"of this resource's locktoken(s).");
}
if (reason == NULL) {
- return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0,
+ return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0, 0,
"The preconditions specified by the \"If:\" "
"header did not match this resource.");
}
- return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0,
+ return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0, 0,
apr_psprintf(p,
"The precondition(s) specified by "
"the \"If:\" header did not match "
@@ -1361,13 +1362,13 @@
** We want to note the 400 (Bad Request) in favor of a 423 (Locked).
*/
if (if_header->dummy_header) {
- return dav_new_error(p, HTTP_BAD_REQUEST, 0,
+ return dav_new_error(p, HTTP_BAD_REQUEST, 0, 0,
"The locktoken specified in the "
"\"Lock-Token:\" header did not specify one "
"of this resource's locktoken(s).");
}
- return dav_new_error(p, HTTP_LOCKED, 1 /* error_id */,
+ return dav_new_error(p, HTTP_LOCKED, 1 /* error_id */, 0,
"This resource is locked and the \"If:\" header "
"did not specify one of the "
"locktokens for this resource's lock(s).");
@@ -1476,7 +1477,7 @@
** ### bleck. we can't return errors for other URIs unless we have
** ### a "response" ptr.
*/
- return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
"DESIGN ERROR: dav_validate_request called "
"with depth>0, but no response ptr.");
}
@@ -1508,7 +1509,7 @@
apr_table_unset(r->headers_out, "ETag");
}
if (result != OK) {
- return dav_new_error(r->pool, result, 0, NULL);
+ return dav_new_error(r->pool, result, 0, 0, NULL);
}
/* always parse (and later process) the If: header */
@@ -1592,7 +1593,7 @@
err = (*repos_hooks->get_parent_resource)(resource, &parent_resource);
if (err == NULL && parent_resource == NULL) {
- err = dav_new_error(r->pool, HTTP_FORBIDDEN, 0,
+ err = dav_new_error(r->pool, HTTP_FORBIDDEN, 0, 0,
"Cannot access parent of repository root.");
}
else if (err == NULL) {
@@ -1648,7 +1649,7 @@
if ((flags & DAV_VALIDATE_USE_424) != 0) {
/* manufacture a 424 error to hold the multistatus response(s) */
- return dav_new_error(r->pool, HTTP_FAILED_DEPENDENCY, 0,
+ return dav_new_error(r->pool, HTTP_FAILED_DEPENDENCY, 0, 0,
"An error occurred on another resource, "
"preventing the requested operation on "
"this resource.");
@@ -1683,7 +1684,7 @@
*response = new_response;
/* manufacture a 207 error for the multistatus response(s) */
- return dav_new_error(r->pool, HTTP_MULTI_STATUS, 0,
+ return dav_new_error(r->pool, HTTP_MULTI_STATUS, 0, 0,
"Error(s) occurred on resources during the "
"validation process.");
}
@@ -1727,7 +1728,7 @@
}
if (*ltl == NULL) {
/* No nodes added */
- return dav_new_error(r->pool, HTTP_BAD_REQUEST, DAV_ERR_IF_ABSENT,
+ return dav_new_error(r->pool, HTTP_BAD_REQUEST, DAV_ERR_IF_ABSENT, 0,
"No locktokens were specified in the \"If:\" "
"header, so the refresh could not be performed.");
}
@@ -1824,7 +1825,7 @@
const dav_hooks_locks *locks_hooks = DAV_GET_HOOKS_LOCKS(r);
if (locks_hooks == NULL) {
- return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
"Auto-checkout is only enabled for locked resources, "
"but there is no lock provider.");
}
@@ -1879,7 +1880,7 @@
goto done;
if (parent == NULL || !parent->exists) {
- err = dav_new_error(r->pool, HTTP_CONFLICT, 0,
+ err = dav_new_error(r->pool, HTTP_CONFLICT, 0, 0,
apr_psprintf(r->pool,
"Missing one or more intermediate "
"collections. Cannot create resource %s.",
@@ -1901,7 +1902,7 @@
}
if (!checkout_parent) {
- err = dav_new_error(r->pool, HTTP_CONFLICT, 0,
+ err = dav_new_error(r->pool, HTTP_CONFLICT, 0, 0,
"<DAV:cannot-modify-checked-in-parent>");
goto done;
}
@@ -1960,7 +1961,7 @@
}
if (!checkout_resource) {
- err = dav_new_error(r->pool, HTTP_CONFLICT, 0,
+ err = dav_new_error(r->pool, HTTP_CONFLICT, 0, 0,
"<DAV:cannot-modify-version-controlled-content>");
goto done;
}
Modified: httpd/httpd/trunk/modules/dav/main/util_lock.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/main/util_lock.c?rev=882274&r1=882273&r2=882274&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/main/util_lock.c (original)
+++ httpd/httpd/trunk/modules/dav/main/util_lock.c Thu Nov 19 20:09:27 2009
@@ -172,7 +172,7 @@
dav_lock *lock;
if (!dav_validate_root(doc, "lockinfo")) {
- return dav_new_error(p, HTTP_BAD_REQUEST, 0,
+ return dav_new_error(p, HTTP_BAD_REQUEST, 0, 0,
"The request body contains an unexpected "
"XML root element.");
}
@@ -187,7 +187,7 @@
lock->depth = dav_get_depth(r, DAV_INFINITY);
if (lock->depth == -1) {
- return dav_new_error(p, HTTP_BAD_REQUEST, 0,
+ return dav_new_error(p, HTTP_BAD_REQUEST, 0, 0,
"An invalid Depth header was specified.");
}
lock->timeout = dav_get_timeout(r);
@@ -230,7 +230,7 @@
continue;
}
- return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0,
+ return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0, 0,
apr_psprintf(p,
"The server cannot satisfy the "
"LOCK request due to an unknown XML "
@@ -346,7 +346,7 @@
if (multi_status != NULL) {
/* manufacture a 207 error for the multistatus response */
*response = multi_status;
- return dav_new_error(r->pool, HTTP_MULTI_STATUS, 0,
+ return dav_new_error(r->pool, HTTP_MULTI_STATUS, 0, 0,
"Error(s) occurred on resources during the "
"addition of a depth lock.");
}
@@ -450,7 +450,7 @@
/* not found! that's an error. */
if (lock == NULL) {
- return dav_new_error(p, HTTP_BAD_REQUEST, 0,
+ return dav_new_error(p, HTTP_BAD_REQUEST, 0, 0,
"The specified locktoken does not correspond "
"to an existing lock on this resource.");
}
@@ -471,7 +471,7 @@
resource = parent;
}
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
"The lock database is corrupt. A direct lock could "
"not be found for the corresponding indirect lock "
"on this resource.");
@@ -600,7 +600,7 @@
}
if (parent == NULL) {
/* ### map result to something nice; log an error */
- return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
"Could not fetch parent resource. Unable to "
"inherit locks from the parent and apply "
"them to this resource.");