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]
* 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
*
*/
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;
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;
}
/* 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.");
}
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.");
}
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.");
}
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.");
}
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.");
#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.");
--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 %"
/* ### 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.");
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));
}
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));
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));
apr_file_t *file = NULL;
dav_error *err = NULL;
apr_size_t amt;
+ apr_status_t rv;
if (pbuf->buf == NULL)
return NULL;
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",
#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");
}
*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.");
}
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");
}
}
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");
}
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");
}
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");
}
/* 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");
}
}
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;
}
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");
}
}
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");
}
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");
}
}
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.");
}
}
#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.");
}
/* 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.");
}
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.");
** 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.");
}
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.");
}
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.");
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.");
}
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.");
}
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.");
}
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.");
}
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.");
}
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.");
}
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.");
}
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;
}
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);
}
}
}
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.");
}
** ### 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.");
}
** ### 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.");
}
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.");
}
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;
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.");
}
}
/* 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 */
{
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;
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);
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;
}
#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.");
}
}
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.");
}
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.");
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.");
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.");
{
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. */
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.");
}
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. */
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.");
}
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;
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;
}
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.");
}
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.");
}
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.");
#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.");
--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 %"
/* ### 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.");
#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");
}
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);
}
}
/* 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.",
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)",
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)",
}
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");
}
}
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");
}
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");
}
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.");
}
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 "
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.",
/* 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);
}
/* 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);
}
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 {
* 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.");
}
/* 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);
}
/* 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);
}
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);
}
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 */
** 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);
#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.");
}
#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
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;
}
*/
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.");
#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)"); */
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;
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);
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 */
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.");
}
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,
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,
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.");
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 "
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 "
*/
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.");
}
*/
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.");
}
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.");
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.");
"\" 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);
}
/*
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).");
** 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 "
** 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).");
** ### 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.");
}
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 */
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) {
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.");
*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.");
}
}
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.");
}
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.");
}
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.",
}
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;
}
}
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;
}
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.");
}
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);
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 "
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.");
}
/* 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.");
}
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.");
}
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.");