From 83b054537a10f88d4c0332f549cbb082d3c8cfbe Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Tue, 6 May 2014 19:22:14 +0200 Subject: [PATCH] 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 845daded5fddc70fc5e822769bc1e2a8cbead7ca) --- src/for-each-disk.c | 3 ++- src/launch-libvirt.c | 3 ++- src/libvirt-domain.c | 3 ++- src/osinfo.c | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/for-each-disk.c b/src/for-each-disk.c index 8a2ecaed2..eb97af2b2 100644 --- a/src/for-each-disk.c +++ b/src/for-each-disk.c @@ -88,7 +88,8 @@ guestfs___for_each_disk (guestfs_h *g, /* Now the horrible task of parsing out the fields we need from the XML. * http://www.xmlsoft.org/examples/xpath1.c */ - doc = xmlParseMemory (xml, strlen (xml)); + doc = xmlReadMemory (xml, strlen (xml), + NULL, NULL, XML_PARSE_NONET); if (doc == NULL) { error_function (g, 0, _("unable to parse XML information returned by libvirt")); diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c index 61886717e..5ae6f39f0 100644 --- a/src/launch-libvirt.c +++ b/src/launch-libvirt.c @@ -515,7 +515,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; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 350068e5a..726f25070 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -334,7 +334,8 @@ connect_live (guestfs_h *g, virDomainPtr dom) } /* Parse XML to 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 -1; diff --git a/src/osinfo.c b/src/osinfo.c index d7aa5e128..ce462dd6a 100644 --- a/src/osinfo.c +++ b/src/osinfo.c @@ -273,7 +273,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;