mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
libvirt: Fix crash on URI without scheme
My commit0d1579572
crashes on a URI without a scheme, like via 'virsh --connect frob' Add a check on uri->server too while we are at it, and centralize them all (cherry picked from commitf1bae376b7
)
This commit is contained in:
parent
af20fbab35
commit
2442bc1c34
@ -942,6 +942,9 @@ virConnectGetDefaultURI(virConfPtr conf,
|
||||
static int
|
||||
virConnectCheckURIMissingSlash(const char *uristr, virURIPtr uri)
|
||||
{
|
||||
if (!uri->scheme || !uri->path || !uri->server)
|
||||
return 0;
|
||||
|
||||
/* To avoid false positives, only check drivers that mandate
|
||||
a path component in the URI, like /system or /session */
|
||||
if (STRNEQ(uri->scheme, "qemu") &&
|
||||
@ -949,9 +952,6 @@ virConnectCheckURIMissingSlash(const char *uristr, virURIPtr uri)
|
||||
STRNEQ(uri->scheme, "vz"))
|
||||
return 0;
|
||||
|
||||
if (uri->path != NULL)
|
||||
return 0;
|
||||
|
||||
if (STREQ(uri->server, "session") ||
|
||||
STREQ(uri->server, "system")) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
|
Loading…
Reference in New Issue
Block a user