libvirt/libvirt-esx-Switch-to-creating-URLs-using-virURIFormat.patch
Jiri Denemark db2f7c04f5 libvirt-11.10.0-4.el10
- qemuDomainSetThrottleGroup: Enforce non-zero 'groupname' string length (RHEL-141820)
- qemuDomainSetBlockIoTuneField: Move setting of 'group_name' out of the loop (RHEL-141820)
- qemuDomainSetThrottleGroup: Always honour thottle group name passed as argument (RHEL-141820)
- qemuDomainSetThrottleGroup: Don't put group name into the 'tunable' event twice (RHEL-141820)
- qemuSnapshotDiskHasBackingDisk: Avoid call of virStorageSourceIsSameLocation with NULL argument (RHEL-144089)
- qemuSnapshotUpdateBackingStore: Remove stale comment (RHEL-144089)
- qemuSnapshotDiskHasBackingDisk: Use proper 'max_depth' when calling 'virStorageSourceGetMetadata' (RHEL-144089)
- virDomainSnapshotDefAssignExternalNames: Improve error message (RHEL-144089)
- qemuSnapshotUpdateBackingStore: Retry as curent user if qemu-img fails (RHEL-144089)
- esx: Debug URL just before opening with curl (RHEL-138300)
- esx: Abstract all URL-creation code into one function (RHEL-138300)
- esx: Switch to creating URLs using virURIFormat (RHEL-138300)
- esx_util: Introduce esxUtil_EscapeInventoryObject() (RHEL-140196)
- esx: URI encode inventory objects twice (RHEL-140196)

Resolves: RHEL-138300, RHEL-140196, RHEL-141820, RHEL-144089
2026-01-29 16:15:49 +01:00

58 lines
1.9 KiB
Diff

From 1ac21634942d30288dd11005d1d832b8dda86ceb Mon Sep 17 00:00:00 2001
Message-ID: <1ac21634942d30288dd11005d1d832b8dda86ceb.1769699749.git.jdenemar@redhat.com>
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 26 Jan 2026 17:54:57 +0000
Subject: [PATCH] esx: Switch to creating URLs using virURIFormat
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since libvirt has existing support for creating URIs, use that rather
than home-rolling our own code without any escaping.
As a side-effect this ensures that URLs containing IPv6 addresses are
escaped correctly, for example as below (note square brackets):
https://[1234:56:0:789a:bcde:72ff:fe0a:7baa]:443/sdk
Fixes: https://issues.redhat.com/browse/RHEL-138300
Updates: commit 845210011a9ffd9d17e30c51cbc81ba67c5d3166
Reported-by: Ming Xie <mxie@redhat.com>
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 13889feb14a24fdf7717960aa5331a0b63ce97ed)
Resolves: https://issues.redhat.com/browse/RHEL-138300
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/esx/esx_driver.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 29735e359f..40b7f793cd 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -588,14 +588,14 @@ esxCreateURL(const char *transport,
int port,
const char *path)
{
- char *url;
+ virURI uri = {
+ .scheme = (char*)transport,
+ .server = (char*)server,
+ .port = port,
+ .path = (char*)path,
+ };
- url = g_strdup_printf("%s://%s:%d%s",
- transport,
- server,
- port,
- path);
- return url;
+ return virURIFormat(&uri);
}
/*
--
2.52.0