lib: xmlParse{File,Memory} -> xmlRead{File,Memory}

Switch from xmlParse* to xmlRead* so we can explicitly specify parsing
flags, including no network usage and no entity resolution.
The two behaviours mentioned above were not done before either, so this
should not introduce behaviour changes in libguestfs.

(cherry picked from commit 845daded5f)
This commit is contained in:
Pino Toscano
2014-05-06 19:22:14 +02:00
committed by Richard W.M. Jones
parent 8fb76be11e
commit 2c41bb8da9
3 changed files with 5 additions and 3 deletions

View File

@@ -505,7 +505,8 @@ parse_capabilities (guestfs_h *g, const char *capabilities_xml,
xmlAttrPtr attr;
size_t seen_qemu, seen_kvm;
doc = xmlParseMemory (capabilities_xml, strlen (capabilities_xml));
doc = xmlReadMemory (capabilities_xml, strlen (capabilities_xml),
NULL, NULL, XML_PARSE_NONET);
if (doc == NULL) {
error (g, _("unable to parse capabilities XML returned by libvirt"));
return -1;

View File

@@ -708,7 +708,8 @@ get_domain_xml (guestfs_h *g, virDomainPtr dom)
}
/* Parse the domain XML into an XML document. */
doc = xmlParseMemory (xml, strlen (xml));
doc = xmlReadMemory (xml, strlen (xml),
NULL, NULL, XML_PARSE_NONET);
if (doc == NULL) {
error (g, _("unable to parse XML information returned by libvirt"));
return NULL;

View File

@@ -269,7 +269,7 @@ read_osinfo_db_xml (guestfs_h *g, const char *filename)
snprintf (pathname, pathname_len, "%s/%s", LIBOSINFO_DB_OS_PATH, filename);
doc = xmlParseFile (pathname);
doc = xmlReadFile (pathname, NULL, XML_PARSE_NONET);
if (doc == NULL) {
debug (g, "osinfo: unable to parse XML file %s", pathname);
return 0;