+Wed Jun 20 10:54:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
+
+ * src/libvirt.c src/test.c src/xen_unified.c: Fix URI processing
+ so that local file URIs work again. Move remote driver to
+ last in the list, and fix all drivers so they decline remote
+ URIs (Daniel Berrange).
+
Tue Jun 19 20:07:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/xend_internal.c: Recognise xen:/// as the standard
* Note that the order is important: the first ones have a higher
* priority when calling virConnectOpen.
*/
-#ifdef WITH_REMOTE
- if (remoteRegister () == -1) return -1;
-#endif
#ifdef WITH_TEST
if (testRegister() == -1) return -1;
#endif
#ifdef WITH_XEN
if (xenUnifiedRegister () == -1) return -1;
#endif
+#ifdef WITH_REMOTE
+ if (remoteRegister () == -1) return -1;
+#endif
return(0);
}
return VIR_DRV_OPEN_DECLINED;
}
+ /* Remote driver should handle these. */
+ if (uri->server) {
+ xmlFreeURI(uri);
+ return VIR_DRV_OPEN_DECLINED;
+ }
+
/* From this point on, the connection is for us. */
if (!uri->path
|| uri->path[0] == '\0'
#include <string.h>
#include <sys/types.h>
#include <xen/dom0_ops.h>
+#include <libxml/uri.h>
#include "internal.h"
{
int i, j;
xenUnifiedPrivatePtr priv;
+ xmlURIPtr uri;
- /* If name == NULL, name == "", or begins with "xen", then it's for us. */
+ /* Convert NULL or "" to xen:/// for back compat */
if (!name || name[0] == '\0')
- name = "Xen";
- if (strncasecmp (name, "Xen", 3) != 0)
+ name = "xen:///";
+
+ /* Convert xen -> xen:/// for back compat */
+ if (!strcasecmp(name, "xen"))
+ name = "xen:///";
+
+ uri = xmlParseURI(name);
+ if (uri == NULL) {
+ xenUnifiedError(NULL, VIR_ERR_NO_SUPPORT, name);
+ return VIR_DRV_OPEN_DECLINED;
+ }
+
+ /* Refuse any URI which doesn't start xen:///, / or http:// */
+ if (uri->scheme &&
+ strcasecmp(uri->scheme, "xen") != 0 &&
+ strcasecmp(uri->scheme, "http")) {
+ xmlFreeURI(uri);
return VIR_DRV_OPEN_DECLINED;
+ }
+
+ /* Refuse any xen:// URI with a server specified - allow remote to do it */
+ if (uri->scheme && !strcasecmp(uri->scheme, "xen") && uri->server) {
+ xmlFreeURI(uri);
+ return VIR_DRV_OPEN_DECLINED;
+ }
+ xmlFreeURI(uri);
/* Allocate per-connection private data. */
priv = malloc (sizeof *priv);