The QEMU driver doesn't cope with URI parameters appended to the end of a path since it is just doing strcmp on the URI. This patch makes it use libxml's URI parsing code Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
diff -r b281c5ec47da src/qemu_driver.c --- a/src/qemu_driver.c Thu Sep 20 16:28:56 2007 -0400 +++ b/src/qemu_driver.c Thu Sep 20 17:16:16 2007 -0400 @@ -45,6 +45,7 @@ #include <pwd.h> #include <stdio.h> #include <sys/wait.h> +#include <libxml/uri.h> #include <libvirt/virterror.h> @@ -1362,25 +1363,37 @@ static int qemudMonitorCommand(struct qe static virDrvOpenStatus qemudOpen(virConnectPtr conn, - const char *name, - int flags ATTRIBUTE_UNUSED) { + const char *name, + int flags ATTRIBUTE_UNUSED) { + xmlURIPtr uri = NULL; uid_t uid = getuid(); if (qemu_driver == NULL) return VIR_DRV_OPEN_DECLINED; + uri = xmlParseURI(name); + if (uri == NULL || uri->scheme == NULL || uri->path == NULL) + return VIR_DRV_OPEN_DECLINED; + + if (STRNEQ (uri->scheme, "qemu")) + goto decline; + if (uid != 0) { - if (STRNEQ (name, "qemu:///session")) - return VIR_DRV_OPEN_DECLINED; + if (STRNEQ (uri->path, "/session")) + goto decline; } else { /* root */ - if (STRNEQ (name, "qemu:///system") && - STRNEQ (name, "qemu:///session")) - return VIR_DRV_OPEN_DECLINED; + if (STRNEQ (uri->path, "/system") && + STRNEQ (uri->path, "/session")) + goto decline; } conn->privateData = qemu_driver; return VIR_DRV_OPEN_SUCCESS; + + decline: + xmlFreeURI(uri); + return VIR_DRV_OPEN_DECLINED; } static int qemudClose(virConnectPtr conn) {
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list