]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
esx: Accept empty "path" URI component same way as "/"
authorPeter Krempa <pkrempa@redhat.com>
Tue, 8 Apr 2025 14:25:37 +0000 (16:25 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 9 Apr 2025 16:04:11 +0000 (18:04 +0200)
When connecting to "esx://" URI there's code which prints a warning that
the path is not "empty". The check validates that "uri->path" is "/".

In case when the user uses URI such as:

 esx://hostname

the warning is printed as well. Since there is no effective difference
betweeen the two allow empty strings as well.

Resolves: https://issues.redhat.com/browse/RHEL-86459
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/esx/esx_driver.c

index 6ae4ef9658e91210a30fc0c81eedafe8428fc413..512ca6c0282db1590f4a98cba4355494303a5008 100644 (file)
@@ -687,7 +687,9 @@ esxConnectToVCenter(esxPrivate *priv,
     g_autofree char *url = NULL;
 
     if (!hostSystemIPAddress &&
-        (!priv->parsedUri->path || STREQ(priv->parsedUri->path, "/"))) {
+        (!priv->parsedUri->path ||
+         STREQ(priv->parsedUri->path, "") ||
+         STREQ(priv->parsedUri->path, "/"))) {
         virReportError(VIR_ERR_INVALID_ARG, "%s",
                        _("Path has to specify the datacenter and compute resource"));
         return -1;
@@ -799,6 +801,7 @@ esxConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
     virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
 
     if (STRCASENEQ(conn->uri->scheme, "vpx") &&
+        STRNEQ(conn->uri->path, "") &&
         STRNEQ(conn->uri->path, "/")) {
         VIR_WARN("Ignoring unexpected path '%s' for non-vpx scheme '%s'",
                  conn->uri->path, conn->uri->scheme);