]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fixed URI parsing
authorMartin Kletzander <mkletzan@redhat.com>
Fri, 24 Feb 2012 18:48:55 +0000 (19:48 +0100)
committerEric Blake <eblake@redhat.com>
Fri, 24 Feb 2012 23:49:21 +0000 (16:49 -0700)
Function xmlParseURI does not remove square brackets around IPv6
address when parsing. One of the solutions is making wrappers around
functions working with xmlURI*. This assures that uri->server will be
always properly assigned and it doesn't have to be changed when used
on some new place in the code.
For this purpose, functions virParseURI and virSaveURI were
added. These function are wrappers around xmlParseURI and xmlSaveUri
respectively.
Also there is one new syntax check function to prohibit these functions
anywhere else.

File changes:
 - src/util/viruri.h        -- declaration
 - src/util/viruri.c        -- definition
 - src/libvirt_private.syms -- symbol export
 - src/Makefile.am          -- added source and header files
 - cfg.mk                   -- added sc_prohibit_xmlURI
 - all others               -- ID name and include fixes

30 files changed:
cfg.mk
src/Makefile.am
src/datatypes.h
src/driver.h
src/esx/esx_driver.c
src/esx/esx_util.c
src/esx/esx_util.h
src/hyperv/hyperv_util.c
src/hyperv/hyperv_util.h
src/libvirt.c
src/libvirt_private.syms
src/libxl/libxl_driver.c
src/lxc/lxc_driver.c
src/openvz/openvz_driver.c
src/qemu/qemu_driver.c
src/qemu/qemu_migration.c
src/remote/remote_driver.c
src/uml/uml_driver.c
src/util/qparams.c
src/util/viruri.c [new file with mode: 0644]
src/util/viruri.h [new file with mode: 0644]
src/vbox/vbox_tmpl.c
src/vmx/vmx.c
src/xen/xen_driver.c
src/xen/xen_hypervisor.h
src/xen/xend_internal.c
src/xen/xend_internal.h
src/xenapi/xenapi_driver.c
src/xenapi/xenapi_utils.c
src/xenapi/xenapi_utils.h

diff --git a/cfg.mk b/cfg.mk
index dcf44bb8c0199f7512e2e03722dab5e33e2431f2..9759d873700ca0e425a73d4aa729bc0eba05ebe7 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -457,6 +457,12 @@ sc_prohibit_xmlGetProp:
        halt='use virXMLPropString, not xmlGetProp'                     \
          $(_sc_search_regexp)
 
+# xml(ParseURI|SaveUri) doesn't handle IPv6 URIs well
+sc_prohibit_xmlURI:
+       @prohibit='\<xml(ParseURI|SaveUri) *\('                         \
+       halt='use virURI(Parse|Format), not xml(ParseURI|SaveUri)'      \
+         $(_sc_search_regexp)
+
 # ATTRIBUTE_UNUSED should only be applied in implementations, not
 # header declarations
 sc_avoid_attribute_unused_in_header:
@@ -758,6 +764,8 @@ exclude_file_name_regexp--sc_prohibit_strncpy = \
 
 exclude_file_name_regexp--sc_prohibit_xmlGetProp = ^src/util/xml\.c$$
 
+exclude_file_name_regexp--sc_prohibit_xmlURI = ^src/util/viruri\.c$$
+
 exclude_file_name_regexp--sc_require_config_h = ^examples/
 
 exclude_file_name_regexp--sc_require_config_h_first = ^examples/
index 9b1921d402f264eaa922a54afbac8a0241d8e29c..376e66517f0a563823badf02fd7c4236aa614b1b 100644 (file)
@@ -104,7 +104,8 @@ UTIL_SOURCES =                                                      \
                util/virnetlink.c util/virnetlink.h             \
                util/virrandom.h util/virrandom.c               \
                util/virsocketaddr.h util/virsocketaddr.c \
-               util/virtime.h util/virtime.c
+               util/virtime.h util/virtime.c \
+               util/viruri.h util/viruri.c
 
 EXTRA_DIST += $(srcdir)/util/virkeymaps.h $(srcdir)/util/keymaps.csv \
                $(srcdir)/util/virkeycode-mapgen.py
index 47058ed137f2f6326912d7cecd78e73a51d3a55e..fc284d281c471e771c4792293f6d25132cdea75f 100644 (file)
@@ -151,7 +151,7 @@ struct _virConnect {
      */
     unsigned int magic;     /* specific value to check */
     unsigned int flags;     /* a set of connection flags */
-    xmlURIPtr uri;          /* connection URI */
+    virURIPtr uri;          /* connection URI */
 
     /* The underlying hypervisor driver and network driver. */
     virDriverPtr      driver;
index d27fa99e89c977f735580655390e7ef04afda8ba..b04b25464995324ef81edc6ac53f819c0ffef424 100644 (file)
@@ -9,9 +9,9 @@
 # include "config.h"
 
 # include <unistd.h>
-# include <libxml/uri.h>
 
 # include "internal.h"
+# include "viruri.h"
 /*
  * List of registered drivers numbers
  */
index f5e1cc73d4ba644606a91c2408cb5c12c8f2724f..b6b22f8d42764bd25d7a816c3fcdc83d46af0356 100644 (file)
@@ -44,6 +44,7 @@
 #include "esx_vi.h"
 #include "esx_vi_methods.h"
 #include "esx_util.h"
+#include "viruri.h"
 
 #define VIR_FROM_THIS VIR_FROM_ESX
 
@@ -3945,7 +3946,7 @@ esxDomainMigratePerform(virDomainPtr domain,
 {
     int result = -1;
     esxPrivate *priv = domain->conn->privateData;
-    xmlURIPtr parsedUri = NULL;
+    virURIPtr parsedUri = NULL;
     char *saveptr;
     char *path_resourcePool;
     char *path_hostSystem;
@@ -3976,7 +3977,7 @@ esxDomainMigratePerform(virDomainPtr domain,
     }
 
     /* Parse migration URI */
-    parsedUri = xmlParseURI(uri);
+    parsedUri = virURIParse(uri);
 
     if (parsedUri == NULL) {
         virReportOOMError();
index 2c5ac1add03153d1a5d97893ee6b7deee38f61ea..7d4b9080e8245261bb2599e503e462b7a4902c09 100644 (file)
@@ -42,7 +42,7 @@
 
 
 int
-esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, xmlURIPtr uri)
+esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
 {
     int result = -1;
     struct qparam_set *queryParamSet = NULL;
index 2bee51051a230cec168134c2681c41405708b752..a69b3f4590a9ed6e797aa2adfb318a2d42861c1d 100644 (file)
@@ -22,9 +22,9 @@
 #ifndef __ESX_UTIL_H__
 # define __ESX_UTIL_H__
 
-# include <libxml/uri.h>
 # include <netdb.h>
 # include "internal.h"
+# include "viruri.h"
 
 typedef struct _esxUtil_ParsedUri esxUtil_ParsedUri;
 
@@ -40,7 +40,7 @@ struct _esxUtil_ParsedUri {
     char *path;
 };
 
-int esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, xmlURIPtr uri);
+int esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri);
 
 void esxUtil_FreeParsedUri(esxUtil_ParsedUri **parsedUri);
 
index 298cfe0eef40c7a02f5aa3d33c8962bac8e49d75..2e6a2d4726b6471919c99f83e353913b9caaaaac 100644 (file)
@@ -37,7 +37,7 @@
 
 
 int
-hypervParseUri(hypervParsedUri **parsedUri, xmlURIPtr uri)
+hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri)
 {
     int result = -1;
     struct qparam_set *queryParamSet = NULL;
index 9057f55c14d26acf57264c4169cfd683bc883482..d9d1c84242c48a2da267048b9f1dff904d591cad 100644 (file)
@@ -23,9 +23,8 @@
 #ifndef __HYPERV_UTIL_H__
 # define __HYPERV_UTIL_H__
 
-# include <libxml/uri.h>
-
 # include "internal.h"
+# include "viruri.h"
 
 typedef struct _hypervParsedUri hypervParsedUri;
 
@@ -33,7 +32,7 @@ struct _hypervParsedUri {
     char *transport;
 };
 
-int hypervParseUri(hypervParsedUri **parsedUri, xmlURIPtr uri);
+int hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri);
 
 void hypervFreeParsedUri(hypervParsedUri **parsedUri);
 
index a3bd4f48a7a7c73f01d660b000efc963cde10ebc..cbb41194c0b9941605b2d39ece6b29ebb470e7d4 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <libxml/parser.h>
 #include <libxml/xpath.h>
-#include <libxml/uri.h>
 #include "getpass.h"
 
 #ifdef HAVE_WINSOCK2_H
@@ -44,6 +43,7 @@
 #include "command.h"
 #include "virnodesuspend.h"
 #include "virrandom.h"
+#include "viruri.h"
 
 #ifndef WITH_DRIVER_MODULES
 # ifdef WITH_TEST
@@ -1127,7 +1127,7 @@ do_open (const char *name,
             virConnectOpenResolveURIAlias(name, &alias) < 0)
             goto failed;
 
-        ret->uri = xmlParseURI (alias ? alias : name);
+        ret->uri = virURIParse (alias ? alias : name);
         if (!ret->uri) {
             virLibConnError(VIR_ERR_INVALID_ARG,
                             _("could not parse connection URI %s"),
@@ -1729,7 +1729,7 @@ virConnectGetURI (virConnectPtr conn)
         return NULL;
     }
 
-    name = (char *)xmlSaveUri(conn->uri);
+    name = virURIFormat(conn->uri);
     if (!name) {
         virReportOOMError();
         goto error;
@@ -4952,7 +4952,7 @@ virDomainMigratePeer2Peer (virDomainPtr domain,
                            const char *uri,
                            unsigned long bandwidth)
 {
-    xmlURIPtr tempuri = NULL;
+    virURIPtr tempuri = NULL;
     VIR_DOMAIN_DEBUG(domain, "xmlin=%s, flags=%lx, dname=%s, "
                      "dconnuri=%s, uri=%s, bandwidth=%lu",
                      NULLSTR(xmlin), flags, NULLSTR(dname),
@@ -4964,7 +4964,7 @@ virDomainMigratePeer2Peer (virDomainPtr domain,
         return -1;
     }
 
-    tempuri = xmlParseURI(dconnuri);
+    tempuri = virURIParse(dconnuri);
     if (!tempuri) {
         virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         virDispatchError(domain->conn);
index 18a24e48542096a0f106b361b2eb5d41c4af0019..310cd7d91e398dae976fb90ca1ec4161b93e9e41 100644 (file)
@@ -1431,6 +1431,11 @@ virTypedParameterArrayValidate;
 virTypedParameterAssign;
 
 
+# viruri.h
+virURIFormat;
+virURIParse;
+
+
 # xml.h
 virXMLChildElementCount;
 virXMLParseHelper;
index 6cfc5eb0b4d2a02b38ff5ff220aee350d40e9ddc..6db33c25e0bb6ab54b7b5f22cbf0910ee1ceb493 100644 (file)
@@ -44,6 +44,7 @@
 #include "libxl_conf.h"
 #include "xen_xm.h"
 #include "virtypedparam.h"
+#include "viruri.h"
 
 #define VIR_FROM_THIS VIR_FROM_LIBXL
 
@@ -1043,7 +1044,7 @@ libxlOpen(virConnectPtr conn,
         if (libxl_driver == NULL)
             return VIR_DRV_OPEN_DECLINED;
 
-        conn->uri = xmlParseURI("xen:///");
+        conn->uri = virURIParse("xen:///");
         if (!conn->uri) {
             virReportOOMError();
             return VIR_DRV_OPEN_ERROR;
index b6962cf792e8a9a02b54d8414a22bbacb9279188..d77afcc4c2f7d64c8625a105ff97a65c621a15a7 100644 (file)
@@ -60,6 +60,7 @@
 #include "virnodesuspend.h"
 #include "virtime.h"
 #include "virtypedparam.h"
+#include "viruri.h"
 
 #define VIR_FROM_THIS VIR_FROM_LXC
 
@@ -139,7 +140,7 @@ static virDrvOpenStatus lxcOpen(virConnectPtr conn,
         if (lxc_driver == NULL)
             return VIR_DRV_OPEN_DECLINED;
 
-        conn->uri = xmlParseURI("lxc:///");
+        conn->uri = virURIParse("lxc:///");
         if (!conn->uri) {
             virReportOOMError();
             return VIR_DRV_OPEN_ERROR;
index 833a98d34cca15850ae97f00d480a7397fa37fbe..aef14915f1494b3efc57e4c2afd26de9c0d7ebbd 100644 (file)
@@ -56,6 +56,7 @@
 #include "virfile.h"
 #include "logging.h"
 #include "command.h"
+#include "viruri.h"
 
 #define VIR_FROM_THIS VIR_FROM_OPENVZ
 
@@ -1335,7 +1336,7 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn,
         if (access("/proc/vz", W_OK) < 0)
             return VIR_DRV_OPEN_DECLINED;
 
-        conn->uri = xmlParseURI("openvz:///system");
+        conn->uri = virURIParse("openvz:///system");
         if (conn->uri == NULL) {
             virReportOOMError();
             return VIR_DRV_OPEN_ERROR;
index d3cf9ac5f69dff352a6329e49cbf94f06372c721..b11d0491668175f2f4da3902e156cc9ca36857a5 100644 (file)
@@ -857,7 +857,7 @@ static virDrvOpenStatus qemudOpen(virConnectPtr conn,
         if (qemu_driver == NULL)
             return VIR_DRV_OPEN_DECLINED;
 
-        conn->uri = xmlParseURI(qemu_driver->privileged ?
+        conn->uri = virURIParse(qemu_driver->privileged ?
                                 "qemu:///system" :
                                 "qemu:///session");
         if (!conn->uri) {
index 3f50136e26ef309daa86c36dcaf1dcc214f8c8a0..7df2d4f8ce678d2ef4dbe6fb0cb8701baa7cf8b2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * qemu_migration.c: QEMU migration handling
  *
- * Copyright (C) 2006-2011 Red Hat, Inc.
+ * Copyright (C) 2006-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -46,6 +46,7 @@
 #include "locking/domain_lock.h"
 #include "rpc/virnetsocket.h"
 #include "storage_file.h"
+#include "viruri.h"
 
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
@@ -1792,7 +1793,7 @@ static int doNativeMigrate(struct qemud_driver *driver,
                            virConnectPtr dconn)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
-    xmlURIPtr uribits = NULL;
+    virURIPtr uribits = NULL;
     int ret = -1;
     qemuMigrationSpec spec;
 
@@ -1808,10 +1809,10 @@ static int doNativeMigrate(struct qemud_driver *driver,
             virReportOOMError();
             return -1;
         }
-        uribits = xmlParseURI(tmp);
+        uribits = virURIParse(tmp);
         VIR_FREE(tmp);
     } else {
-        uribits = xmlParseURI(uri);
+        uribits = virURIParse(uri);
     }
     if (!uribits) {
         qemuReportError(VIR_ERR_INTERNAL_ERROR,
index 2dacb70f6351779f85d3f1efd262772a548add2b..bcd78eedb120828d66fbe10d07ca6ab4440b1736 100644 (file)
@@ -26,8 +26,6 @@
 #include <unistd.h>
 #include <assert.h>
 
-#include <libxml/uri.h>
-
 #include "virnetclient.h"
 #include "virnetclientprogram.h"
 #include "virnetclientstream.h"
@@ -47,6 +45,7 @@
 #include "command.h"
 #include "intprops.h"
 #include "virtypedparam.h"
+#include "viruri.h"
 
 #define VIR_FROM_THIS VIR_FROM_REMOTE
 
@@ -488,7 +487,7 @@ doRemoteOpen (virConnectPtr conn,
                 /* Allow remote serve to probe */
                 name = strdup("");
             } else {
-                xmlURI tmpuri = {
+                virURI tmpuri = {
                     .scheme = conn->uri->scheme,
 #ifdef HAVE_XMLURI_QUERY_RAW
                     .query_raw = qparam_get_query (vars),
@@ -505,7 +504,7 @@ doRemoteOpen (virConnectPtr conn,
                     transport_str[-1] = '\0';
                 }
 
-                name = (char *) xmlSaveUri (&tmpuri);
+                name = virURIFormat(&tmpuri);
 
 #ifdef HAVE_XMLURI_QUERY_RAW
                 VIR_FREE(tmpuri.query_raw);
@@ -719,7 +718,7 @@ doRemoteOpen (virConnectPtr conn,
             goto failed;
 
         VIR_DEBUG("Auto-probed URI is %s", uriret.uri);
-        conn->uri = xmlParseURI(uriret.uri);
+        conn->uri = virURIParse(uriret.uri);
         VIR_FREE(uriret.uri);
         if (!conn->uri) {
             virReportOOMError();
index a4cf9452a7aead6971bd9fe359f5129516e283b0..cbb2c0ed4191e2c5bff476cb9f9a83a942f6ed02 100644 (file)
@@ -63,6 +63,7 @@
 #include "configmake.h"
 #include "virnetdevtap.h"
 #include "virnodesuspend.h"
+#include "viruri.h"
 
 #define VIR_FROM_THIS VIR_FROM_UML
 
@@ -1138,7 +1139,7 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn,
         if (uml_driver == NULL)
             return VIR_DRV_OPEN_DECLINED;
 
-        conn->uri = xmlParseURI(uml_driver->privileged ?
+        conn->uri = virURIParse(uml_driver->privileged ?
                                 "uml:///system" :
                                 "uml:///session");
         if (!conn->uri) {
index f6d0713cc63966acf25d307d8f2be17a1a538ab1..83b568e3d5cba3bae972120e89253601d2e55b9f 100644 (file)
 #include <stdlib.h>
 #include <stdarg.h>
 
-#include <libxml/uri.h>
-
 #include "virterror_internal.h"
 #include "buf.h"
 #include "memory.h"
 #include "qparams.h"
+#include "viruri.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/viruri.c b/src/util/viruri.c
new file mode 100644 (file)
index 0000000..6c4dfe3
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * viruri.c: URI parsing wrappers for libxml2 functions
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ *
+ * See COPYING.LIB for the License of this software
+ */
+
+#include <config.h>
+
+#include "viruri.h"
+
+#include "memory.h"
+#include "util.h"
+
+/**
+ * virURIParse:
+ * @uri: URI to parse
+ *
+ * Wrapper for xmlParseURI
+ *
+ * Unfortunately there are few things that should be managed after
+ * parsing the URI. Fortunately there is only one thing now and its
+ * removing of square brackets around IPv6 addresses.
+ *
+ * @returns the parsed uri object with some fixes
+ */
+virURIPtr
+virURIParse(const char *uri)
+{
+    virURIPtr ret = xmlParseURI(uri);
+
+    /* First check: does it even make sense to jump inside */
+    if (ret != NULL &&
+        ret->server != NULL &&
+        ret->server[0] == '[') {
+        size_t length = strlen(ret->server);
+
+        /* We want to modify the server string only if there are
+         * square brackets on both ends and inside there is IPv6
+         * address. Otherwise we could make a mistake by modifying
+         * something other than an IPv6 address. */
+        if (ret->server[length - 1] == ']' && strchr(ret->server, ':')) {
+            memmove(&ret->server[0], &ret->server[1], length - 2);
+            ret->server[length - 2] = '\0';
+        }
+        /* Even after such modification, it is completely ok to free
+         * the uri with xmlFreeURI() */
+    }
+
+    return ret;
+}
+
+/**
+ * virURIFormat:
+ * @uri: URI to format
+ *
+ * Wrapper for xmlSaveUri
+ *
+ * This function constructs back everything that @ref virURIParse
+ * changes after parsing
+ *
+ * @returns the constructed uri as a string
+ */
+char *
+virURIFormat(xmlURIPtr uri)
+{
+    char *backupserver = NULL;
+    char *tmpserver = NULL;
+    char *ret;
+
+    /* First check: does it make sense to do anything */
+    if (uri != NULL &&
+        uri->server != NULL &&
+        strchr(uri->server, ':') != NULL) {
+
+        backupserver = uri->server;
+        if (virAsprintf(&tmpserver, "[%s]", uri->server) < 0)
+            return NULL;
+
+        uri->server = tmpserver;
+    }
+
+    ret = (char *) xmlSaveUri(uri);
+
+    /* Put the fixed version back */
+    if (tmpserver) {
+        uri->server = backupserver;
+        VIR_FREE(tmpserver);
+    }
+
+    return ret;
+}
diff --git a/src/util/viruri.h b/src/util/viruri.h
new file mode 100644 (file)
index 0000000..5215e42
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * viruri.h: internal definitions used for URI parsing.
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ *
+ * See COPYING.LIB for the License of this software
+ */
+
+#ifndef __VIR_URI_H__
+# define __VIR_URI_H__
+
+# include <libxml/uri.h>
+
+# include "internal.h"
+
+typedef xmlURI    virURI;
+typedef xmlURIPtr virURIPtr;
+
+virURIPtr virURIParse(const char *uri);
+char *virURIFormat(virURIPtr uri);
+
+#endif /* __VIR_URI_H__ */
index b168c7db3540dc576d59632689aa586150ecddfd..a39b5677b1698d3bf58e4adf18d8b8f62ab035eb 100644 (file)
@@ -56,6 +56,7 @@
 #include "configmake.h"
 #include "virfile.h"
 #include "fdstream.h"
+#include "viruri.h"
 
 /* This one changes from version to version. */
 #if VBOX_API_VERSION == 2002
@@ -980,7 +981,7 @@ static virDrvOpenStatus vboxOpen(virConnectPtr conn,
     virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
 
     if (conn->uri == NULL) {
-        conn->uri = xmlParseURI(uid ? "vbox:///session" : "vbox:///system");
+        conn->uri = virURIParse(uid ? "vbox:///session" : "vbox:///system");
         if (conn->uri == NULL) {
             virReportOOMError();
             return VIR_DRV_OPEN_ERROR;
index 910bb0eb69150c90ddf8419c7d42724ab1b8a7a9..5a1aebd8e51a08dc91f86cbc9f5a1359b10ff41c 100644 (file)
@@ -24,7 +24,6 @@
 #include <config.h>
 
 #include <c-ctype.h>
-#include <libxml/uri.h>
 
 #include "internal.h"
 #include "virterror_internal.h"
@@ -33,6 +32,7 @@
 #include "logging.h"
 #include "uuid.h"
 #include "vmx.h"
+#include "viruri.h"
 
 /*
 
@@ -2525,7 +2525,7 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
     char network_endPoint_name[48] = "";
     char *network_endPoint = NULL;
 
-    xmlURIPtr parsedUri = NULL;
+    virURIPtr parsedUri = NULL;
 
     if (def == NULL || *def != NULL) {
         VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
@@ -2615,7 +2615,7 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
         (*def)->target.port = port;
         (*def)->source.type = VIR_DOMAIN_CHR_TYPE_TCP;
 
-        parsedUri = xmlParseURI(fileName);
+        parsedUri = virURIParse(fileName);
 
         if (parsedUri == NULL) {
             virReportOOMError();
index 635f4685b07fd0a07ce59ca9e806d04590378f55..19ce7dae654370845d4a3c12044623bc6231f6a2 100644 (file)
@@ -26,7 +26,6 @@
 #include <sys/types.h>
 #include <fcntl.h>
 #include <xen/dom0_ops.h>
-#include <libxml/uri.h>
 
 #include "virterror_internal.h"
 #include "logging.h"
@@ -50,6 +49,7 @@
 #include "uuid.h"
 #include "fdstream.h"
 #include "virfile.h"
+#include "viruri.h"
 #include "command.h"
 #include "virnodesuspend.h"
 
@@ -270,7 +270,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
         if (!xenUnifiedProbe())
             return VIR_DRV_OPEN_DECLINED;
 
-        conn->uri = xmlParseURI("xen:///");
+        conn->uri = virURIParse("xen:///");
         if (!conn->uri) {
             virReportOOMError();
             return VIR_DRV_OPEN_ERROR;
index 77c6f747257a8e04341f7fff50f7c8d891d7f08a..55a99f15c3a73b8962cee901d3627b1e8695e7f4 100644 (file)
 #ifndef __VIR_XEN_INTERNAL_H__
 # define __VIR_XEN_INTERNAL_H__
 
-# include <libxml/uri.h>
-
 # include "internal.h"
 # include "capabilities.h"
 # include "driver.h"
+# include "viruri.h"
 
 /* See xenHypervisorInit() for details. */
 struct xenHypervisorVersions {
index 5c3838fe65e96886b5896ef0e170d3cdf6f14882..83bfac0f272b68e33811c9b66d9b0895d43e2691 100644 (file)
@@ -27,7 +27,6 @@
 #include <netinet/tcp.h>
 #include <arpa/inet.h>
 #include <netdb.h>
-#include <libxml/uri.h>
 #include <errno.h>
 
 #include "virterror_internal.h"
@@ -46,6 +45,7 @@
 #include "memory.h"
 #include "count-one-bits.h"
 #include "virfile.h"
+#include "viruri.h"
 
 /* required for cpumap_t */
 #include <xen/dom0_ops.h>
@@ -3224,7 +3224,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
      * "hostname", "hostname:port" or "xenmigr://hostname[:port]/".
      */
     if (strstr (uri, "//")) {   /* Full URI. */
-        xmlURIPtr uriptr = xmlParseURI (uri);
+        virURIPtr uriptr = virURIParse (uri);
         if (!uriptr) {
             virXendError(VIR_ERR_INVALID_ARG,
                           "%s", _("xenDaemonDomainMigrate: invalid URI"));
index eee67b5a1737b335e695df286698bbbace58509e..3f0b63d6ab05b11b9fb3929eeb4cc0fc9815254c 100644 (file)
 
 # include <sys/types.h>
 # include <stdint.h>
-# include <libxml/uri.h>
 
 # include "internal.h"
 # include "capabilities.h"
 # include "domain_conf.h"
 # include "driver.h"
 # include "buf.h"
+# include "viruri.h"
 
 int
 xenDaemonOpen_unix(virConnectPtr conn, const char *path);
index f877f671fb3a6266b1fecf1740c93386b6108141..94644ae025cd75bf6ad413a9c7a4f59b5fd75bdf 100644 (file)
@@ -25,7 +25,6 @@
 #include <limits.h>
 #include <stdint.h>
 #include <string.h>
-#include <libxml/uri.h>
 #include <curl/curl.h>
 #include <xen/api/xen_all.h>
 #include "internal.h"
@@ -37,6 +36,7 @@
 #include "uuid.h"
 #include "memory.h"
 #include "buf.h"
+#include "viruri.h"
 #include "xenapi_driver.h"
 #include "xenapi_driver_private.h"
 #include "xenapi_utils.h"
index ddc77366ae112caf67310360bd696909bf41a568..943b6c0d24029ccd445d5a90ae2691bb8aaf49bc 100644 (file)
@@ -25,7 +25,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdint.h>
-#include <libxml/uri.h>
 #include <xen/api/xen_all.h>
 #include "internal.h"
 #include "domain_conf.h"
@@ -37,6 +36,7 @@
 #include "buf.h"
 #include "logging.h"
 #include "qparams.h"
+#include "viruri.h"
 #include "xenapi_driver_private.h"
 #include "xenapi_utils.h"
 
@@ -94,7 +94,7 @@ xenapiUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
 }
 
 int
-xenapiUtil_ParseQuery(virConnectPtr conn, xmlURIPtr uri, int *noVerify)
+xenapiUtil_ParseQuery(virConnectPtr conn, virURIPtr uri, int *noVerify)
 {
     int result = 0;
     int i;
index 40506d5c37702ed7d1d4fe1de5c1f6560089f622..aa1ff740d0804d0ee89113d1cc3766c458482807 100644 (file)
@@ -23,9 +23,9 @@
 # define __VIR_XENAPI_UTILS__
 
 # include <stdint.h>
-# include <libxml/uri.h>
 # include <xen/api/xen_all.h>
 # include "internal.h"
+# include "viruri.h"
 # include "domain_conf.h"
 
 # define NETWORK_DEVID_SIZE  (12)
@@ -40,7 +40,7 @@ xenapiUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
                            const char *hostname);
 
 int
-xenapiUtil_ParseQuery(virConnectPtr conn, xmlURIPtr uri, int *noVerify);
+xenapiUtil_ParseQuery(virConnectPtr conn, virURIPtr uri, int *noVerify);
 
 enum xen_on_normal_exit
 actionShutdownLibvirt2XenapiEnum(enum virDomainLifecycleAction action);