gstein 02/04/05 16:19:19
Modified: modules/dav/fs dbm.c
xml apr_xml.c
Log:
Port over some fixes to mod_dav 1.0 so that the Apache 2.0 DAV code
will pass the "litmus" DAV test tool.
In particular, we need to properly handle empty namespaces properly.
Revision Changes Path
1.24 +7 -0 httpd-2.0/modules/dav/fs/dbm.c
Index: dbm.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/dav/fs/dbm.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- dbm.c 13 Mar 2002 20:47:45 -0000 1.23
+++ dbm.c 6 Apr 2002 00:19:19 -0000 1.24
@@ -544,6 +544,13 @@
/* within the prop values, we use "ns%d" for prefixes... register them */
for (ns = 0; ns < db->ns_count; ++ns, uri += strlen(uri) + 1) {
+ /* Empty URIs signify the empty namespace. These do not get a
+ namespace prefix. when we generate the value, we will simply
+ leave off the prefix, which is defined by mod_dav to be the
+ empty namespace. */
+ if (*uri == '\0')
+ continue;
+
/* ns_table.buf can move, so copy its value (we want the values to
last as long as the provided dav_xmlns_info). */
dav_xmlns_add(xi,
1.25 +17 -1 apr-util/xml/apr_xml.c
Index: apr_xml.c
===================================================================
RCS file: /home/cvs/apr-util/xml/apr_xml.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- apr_xml.c 13 Mar 2002 20:40:49 -0000 1.24
+++ apr_xml.c 6 Apr 2002 00:19:19 -0000 1.25
@@ -73,6 +73,7 @@
/* errors related to namespace processing */
#define APR_XML_NS_ERROR_UNKNOWN_PREFIX (-1000)
+#define APR_XML_NS_ERROR_INVALID_DECL (-1001)
/* test for a namespace prefix that begins with [Xx][Mm][Ll] */
#define APR_XML_NS_IS_RESERVED(name) \
@@ -210,8 +211,15 @@
apr_xml_ns_scope *ns_scope;
/* test for xmlns:foo= form and xmlns= form */
- if (*prefix == ':')
+ if (*prefix == ':') {
+ /* a namespace prefix declaration must have a
+ non-empty value. */
+ if (attr->value[0] == '\0') {
+ parser->error = APR_XML_NS_ERROR_INVALID_DECL;
+ return;
+ }
++prefix;
+ }
else if (*prefix != '\0') {
/* advance "prev" since "attr" is still present */
prev = attr;
@@ -460,6 +468,10 @@
msg = "An undefined namespace prefix was used.";
break;
+ case APR_XML_NS_ERROR_INVALID_DECL:
+ msg = "A namespace prefix was defined with an empty URI.";
+ break;
+
case APR_XML_ERROR_EXPAT:
(void) apr_snprintf(errbuf, errbufsize,
"XML parser error code: %s (%d)",
@@ -895,6 +907,10 @@
{
int i;
const char **pelt;
+
+ /* never insert an empty URI; this index is always APR_XML_NS_NONE */
+ if (*uri == '\0')
+ return APR_XML_NS_NONE;
for (i = uri_array->nelts; i--;) {
if (strcmp(uri, APR_XML_GET_URI_ITEM(uri_array, i)) == 0)