props.c revision 8a46775d163c06a8c51d1b0a3f2edfde945cb1d8
208651a016b098f4fa1f6279559f104d70f1632dtakashi/* ====================================================================
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * The Apache Software License, Version 1.1
4a47ffe35ce63fff3a755f750e6dcce8c4bfe52ctakashi * Copyright (c) 2000 The Apache Software Foundation. All rights
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * reserved.
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * Redistribution and use in source and binary forms, with or without
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * modification, are permitted provided that the following conditions
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * 1. Redistributions of source code must retain the above copyright
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * notice, this list of conditions and the following disclaimer.
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * 2. Redistributions in binary form must reproduce the above copyright
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * notice, this list of conditions and the following disclaimer in
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * the documentation and/or other materials provided with the
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * distribution.
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * 3. The end-user documentation included with the redistribution,
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * if any, must include the following acknowledgment:
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * "This product includes software developed by the
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * Apache Software Foundation (http://www.apache.org/)."
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * Alternately, this acknowledgment may appear in the software itself,
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * if and wherever such third-party acknowledgments normally appear.
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * 4. The names "Apache" and "Apache Software Foundation" must
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * not be used to endorse or promote products derived from this
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * software without prior written permission. For written
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * permission, please contact apache@apache.org.
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * 5. Products derived from this software may not be called "Apache",
208651a016b098f4fa1f6279559f104d70f1632dtakashi * nor may "Apache" appear in their name, without prior written
208651a016b098f4fa1f6279559f104d70f1632dtakashi * permission of the Apache Software Foundation.
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
208651a016b098f4fa1f6279559f104d70f1632dtakashi * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
208651a016b098f4fa1f6279559f104d70f1632dtakashi * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * SUCH DAMAGE.
b3dff74af4d269de76653c5e88c9be64e24568f4takashi * ====================================================================
208651a016b098f4fa1f6279559f104d70f1632dtakashi * This software consists of voluntary contributions made by many
208651a016b098f4fa1f6279559f104d70f1632dtakashi * individuals on behalf of the Apache Software Foundation. For more
208651a016b098f4fa1f6279559f104d70f1632dtakashi * information on the Apache Software Foundation, please see
b3dff74af4d269de76653c5e88c9be64e24568f4takashi** DAV extension module for Apache 2.0.*
208651a016b098f4fa1f6279559f104d70f1632dtakashi** - Property database handling (repository-independent)
208651a016b098f4fa1f6279559f104d70f1632dtakashi** PROPERTY DATABASE
208651a016b098f4fa1f6279559f104d70f1632dtakashi** This version assumes that there is a per-resource database provider
208651a016b098f4fa1f6279559f104d70f1632dtakashi** to record properties. The database provider decides how and where to
208651a016b098f4fa1f6279559f104d70f1632dtakashi** store these databases.
208651a016b098f4fa1f6279559f104d70f1632dtakashi** The DBM keys for the properties have the following form:
b3dff74af4d269de76653c5e88c9be64e24568f4takashi** namespace ":" propname
b3dff74af4d269de76653c5e88c9be64e24568f4takashi** For example: 5:author
208651a016b098f4fa1f6279559f104d70f1632dtakashi** The namespace provides an integer index into the namespace table
b3dff74af4d269de76653c5e88c9be64e24568f4takashi** (see below). propname is simply the property name, without a namespace
b3dff74af4d269de76653c5e88c9be64e24568f4takashi** A special case exists for properties that had a prefix starting with
b3dff74af4d269de76653c5e88c9be64e24568f4takashi** "xml". The XML Specification reserves these for future use. mod_dav
208651a016b098f4fa1f6279559f104d70f1632dtakashi** stores and retrieves them unchanged. The keys for these properties
208651a016b098f4fa1f6279559f104d70f1632dtakashi** have the form:
208651a016b098f4fa1f6279559f104d70f1632dtakashi** ":" propname
b3dff74af4d269de76653c5e88c9be64e24568f4takashi** The propname will contain the prefix and the property name. For
b3dff74af4d269de76653c5e88c9be64e24568f4takashi** example, a key might be ":xmlfoo:name"
b3dff74af4d269de76653c5e88c9be64e24568f4takashi** The ":name" style will also be used for properties that do not
b3dff74af4d269de76653c5e88c9be64e24568f4takashi** exist within a namespace.
** For example: http://www.foo.bar/standards/props/
** acceptable -- it is presumed that old/new dav_props.c can deal with
#include "mod_dav.h"
#include "http_log.h"
#include "http_request.h"
#include "apr_strings.h"
unsigned char major;
unsigned char minor;
#define DAV_DBVSN_MINOR 0
short ns_count;
struct dav_propdb {
static const char * const dav_core_props[] =
typedef struct dav_rollback_item {
while (ns--)
int propid;
const char *ns_uri;
const char * const *p = dav_core_props;
if (propid != 0) {
int getvals,
int *inserted)
*inserted = 0;
return NULL;
switch (propid) {
err);
const char *lang;
case DAV_PROPID_CORE_UNKNOWN:
return NULL;
int getvals,
int *inserted)
*inserted = 0;
#if DAV_DEBUG
return NULL;
const char **puri;
int *pmap;
if (updating) {
j < orig_count;
*pmap = j;
goto next_input_uri;
if (!add_ns) {
int ns;
return ns;
const char *pre_prefix,
phdr);
int ns;
l_ns = 0;
return key;
err);
return err;
dav_propdb_metadata m = {
return NULL;
int ro,
#if DAV_DEBUG
propdb->r = r;
if (!ro) {
return err;
return NULL;
int found_resourcetype = 0;
int found_contenttype = 0;
int found_contentlang = 0;
int unused_inserted;
goto next_key;
const char *colon;
if (getvals) {
goto next_key;
if (!found_resourcetype) {
if (!found_contenttype) {
if (!found_contentlang) {
return result;
int have_good = 0;
char *marks_input;
char *marks_liveprop;
int inserted;
if (inserted) {
const char * const * scan_ns_uri;
++scan_ns_uri) {
int ns;
&hdr_ns);
if (!have_good) {
return result;
int defer_to_dead = 0;
goto error;