Using Diameter dissector with XML definition files on WIN32 platforms
doesn't work.
It has been reported by several people:
http://www.ethereal.com/lists/ethereal-dev/200403/msg00748.html
http://www.ethereal.com/lists/ethereal-users/200405/msg00153.html
http://www.ethereal.com/lists/ethereal-users/200307/msg00247.html
The patch attached fixes this issue by removing XML validation against
DTD. Please check it in.
It could look radical, but XML validation is not really necessary in our
case.
I also tested the fact that having syntax errors in the dictionary files
are still properly detected.
Tested OK on Debian woody and win32 systems.
For WIN32 system, you have to put the libxml2.dll from
http://www.zlatkovic.com/libxml.en.html#binaries in the path where
Ethereal can find it. I putted mine in c:\windows\system32\
Thanks to Anders who was kind enough to do some initial testing.
Olivier.
Index: xmlstub.c
===================================================================
--- xmlstub.c (revision 12277)
+++ xmlstub.c (working copy)
@@ -145,12 +145,6 @@
}
XmlStub.xmlSubstituteEntitiesDefault=(int(*)(int))symbol;
- if (!g_module_symbol(handle, "xmlDoValidityCheckingDefaultValue", &symbol)) {
- g_warning("Unable to find \"xmlDoValidityCheckingDefaultValue\"");
- error=TRUE;
- }
- XmlStub.xmlDoValidityCheckingDefaultValue = (int *)symbol;
-
/*
* Return if any of the above functions set our error flag.
* A flag was used, instead of returning immediately, so
Index: xmlstub.h
===================================================================
--- xmlstub.h (revision 12277)
+++ xmlstub.h (working copy)
@@ -1089,9 +1089,6 @@
int (*xmlKeepBlanksDefault)(int);
int (*xmlSubstituteEntitiesDefault)(int);
- /* Variables */
- int *xmlDoValidityCheckingDefaultValue;
-
} XML_STUB;
XML_EXTERN XML_STUB XmlStub;
Index: epan/dissectors/packet-diameter.c
===================================================================
--- epan/dissectors/packet-diameter.c (revision 12277)
+++ epan/dissectors/packet-diameter.c (working copy)
@@ -311,14 +311,10 @@
xmlParseFilePush( char *filename, int checkValid) {
FILE *f;
xmlDocPtr doc=NULL;
- int valid=0;
int res, size = 1024;
char chars[1024];
xmlParserCtxtPtr ctxt;
- /* I wonder what kind of a performance hit this is? */
- *XmlStub.xmlDoValidityCheckingDefaultValue = checkValid;
-
f = fopen(filename, "r");
if (f == NULL) {
report_open_failure(filename, errno, FALSE);
@@ -334,17 +330,10 @@
}
XmlStub.xmlParseChunk(ctxt, chars, 0, 1);
doc = ctxt->myDoc;
- valid=ctxt->valid;
XmlStub.xmlFreeParserCtxt(ctxt);
}
fclose(f);
- /* Check valid */
- if (!valid) {
- report_failure( "Error! Invalid xml in %s! Failed DTD check!",
- filename);
- return NULL;
- }
return doc;
} /* xmlParseFilePush */