aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2004-10-18 14:58:32 +0000
committerGerald Combs <gerald@wireshark.org>2004-10-18 14:58:32 +0000
commitd7d9c6be54d7d7c6d5df15639d7e3b1f1a785812 (patch)
tree9fe5c95951ecdf5a33e88844824127483054718c
parentd6a21825355b38955fd907ef2c538997a24e7f99 (diff)
From Olivier Jacques: Add #defines to disable XML validation.
svn path=/trunk/; revision=12340
-rw-r--r--epan/dissectors/packet-diameter.c11
-rw-r--r--xmlstub.c4
-rw-r--r--xmlstub.h14
3 files changed, 23 insertions, 6 deletions
diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c
index 3e33e243ca..a8258ff31f 100644
--- a/epan/dissectors/packet-diameter.c
+++ b/epan/dissectors/packet-diameter.c
@@ -311,13 +311,17 @@ static xmlDocPtr
xmlParseFilePush( char *filename, int checkValid) {
FILE *f;
xmlDocPtr doc=NULL;
+#ifdef ETHEREAL_XML_DO_VALIDITY_CHECKING
int valid=0;
+#endif
int res, size = 1024;
char chars[1024];
xmlParserCtxtPtr ctxt;
+#ifdef ETHEREAL_XML_DO_VALIDITY_CHECKING
/* I wonder what kind of a performance hit this is? */
*XmlStub.xmlDoValidityCheckingDefaultValue = checkValid;
+#endif
f = fopen(filename, "r");
if (f == NULL) {
@@ -334,17 +338,22 @@ xmlParseFilePush( char *filename, int checkValid) {
}
XmlStub.xmlParseChunk(ctxt, chars, 0, 1);
doc = ctxt->myDoc;
- valid=ctxt->valid;
+#ifdef ETHEREAL_XML_DO_VALIDITY_CHECKING
+ valid=ctxt->valid;
+#endif
XmlStub.xmlFreeParserCtxt(ctxt);
}
fclose(f);
+#ifdef ETHEREAL_XML_DO_VALIDITY_CHECKING
/* Check valid */
if (!valid) {
report_failure( "Error! Invalid xml in %s! Failed DTD check!",
filename);
return NULL;
}
+#endif
+
return doc;
} /* xmlParseFilePush */
diff --git a/xmlstub.c b/xmlstub.c
index c64bdd02af..6ceb9c32be 100644
--- a/xmlstub.c
+++ b/xmlstub.c
@@ -145,11 +145,13 @@ loadLibXML(void)
}
XmlStub.xmlSubstituteEntitiesDefault=(int(*)(int))symbol;
- if (!g_module_symbol(handle, "xmlDoValidityCheckingDefaultValue", &symbol)) {
+#ifdef ETHEREAL_XML_DO_VALIDITY_CHECKING
+ if (!g_module_symbol(handle, "xmlDoValidityCheckingDefaultValue", &symbol)) {
g_warning("Unable to find \"xmlDoValidityCheckingDefaultValue\"");
error=TRUE;
}
XmlStub.xmlDoValidityCheckingDefaultValue = (int *)symbol;
+#endif
/*
* Return if any of the above functions set our error flag.
diff --git a/xmlstub.h b/xmlstub.h
index 54532dcaf0..47a6d0a0ef 100644
--- a/xmlstub.h
+++ b/xmlstub.h
@@ -8,6 +8,13 @@
#include "config.h"
+/****************** specific to ethereal ********************************/
+/*
+ * Uncomment the following line to restore XML_DO_VALIDITY_CHECKING
+ * behavior which is causing issues on WIN32 platforms. See:
+ * http://www.ethereal.com/lists/ethereal-dev/200410/msg00194.html
+ */
+/* #define ETHEREAL_XML_DO_VALIDITY_CHECKING */
/****************** From xml headers ************************************/
/*
@@ -1088,10 +1095,9 @@ typedef struct {
char *(*xmlGetProp)(xmlNodePtr, char *);
int (*xmlKeepBlanksDefault)(int);
int (*xmlSubstituteEntitiesDefault)(int);
-
- /* Variables */
- int *xmlDoValidityCheckingDefaultValue;
-
+#ifdef ETHEREAL_XML_DO_VALIDITY_CHECKING
+ int *xmlDoValidityCheckingDefaultValue;
+#endif
} XML_STUB;
XML_EXTERN XML_STUB XmlStub;