From nobody Mon Feb 2 07:17:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1767862803; cv=none; d=zohomail.com; s=zohoarc; b=T2bbjI8fqFVUYoJYmVPtp0Rb6L5OhnxIj7swWN6Y4BqpDmEQNJgt2LjlfMuxDn7KvapwSi8fvosU6nsn38krxPHTMfig4YyWYn3sZ1TlF3bS//6K9/dpPCKU8oOkljqjClUb6Y3+2Lrq1HPn7PwE3r4W0xsxlbgf3I7xemcxiAk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767862803; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=C78WLZf504hTHgrWDpArnwSBeSaaE0dggUs+DmJPm7Q=; b=YO0Dbkug6qkpAW0bHmgZvEH1PevrhVJ3bGdj2NkzDTJzJW4l4QrTl+BENXsdJOQumffwGvB1kSF7uGN4X8oXl+2Ho+H1uPf0hBgi/FmTIBLSqOWVwy0lLqJtI1oft1EatO6wEdZWIKFHlJy50rmvmQdJTN6l+7yMlzQgFQKH2eQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1767862803207446.9607943499236; Thu, 8 Jan 2026 01:00:03 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 1C57141C4E; Thu, 8 Jan 2026 04:00:02 -0500 (EST) Received: from [172.19.199.83] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 449324408A; Thu, 8 Jan 2026 03:54:45 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id A074E3F35F; Thu, 8 Jan 2026 03:54:30 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id C065943EEF for ; Thu, 8 Jan 2026 03:23:37 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-343-kN4BUPWPPdeEJUPL8y7jqA-1; Thu, 08 Jan 2026 03:23:35 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8104F18005B9 for ; Thu, 8 Jan 2026 08:23:34 +0000 (UTC) Received: from moe (unknown [10.43.3.236]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DFADB180009E for ; Thu, 8 Jan 2026 08:23:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1767860616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C78WLZf504hTHgrWDpArnwSBeSaaE0dggUs+DmJPm7Q=; b=M415gDvLaMhY5fK9dPdndi1r2nkO+Z1+LD6lYrDz/Jcr8R6XHkWe0VL9Y+UAAyuaHLEu9/ s8p/vEsZrQ4R5/ZAbuZOcCzL7yBVlC4LLk8zqlS42HC4HQ36TZBCo4IwH3DzDAgNDJrsJh /h96Heg5btNqrUd7xiRxoMc/Xmw+HFA= X-MC-Unique: kN4BUPWPPdeEJUPL8y7jqA-1 X-Mimecast-MFC-AGG-ID: kN4BUPWPPdeEJUPL8y7jqA_1767860614 To: devel@lists.libvirt.org Subject: [PATCH 1/2] esx_util: Introduce esxUtil_EscapeInventoryObject() Date: Thu, 8 Jan 2026 09:23:23 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Gfmc2AmN7Wk08TMCx8dvnhiABpSwvKm-1HGx5_ljHaY_1767860614 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NTXDGMJEZNE73POWIYCVOJ44GPGSWRAE X-Message-ID-Hash: NTXDGMJEZNE73POWIYCVOJ44GPGSWRAE X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1767862805676158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik The aim of this helper function is to URI-encode given string twice. There's a bug (fixed in next commit) in which we're unable to fetch .vmx file for a domain if corresponding datastore contains some special characters (like +). Cole Robinson discovered that encoding datastore twice enables libvirt to work around the issue [2]. Well, this function does exactly that. It was tested with the following inputs and all worked flawlessly: "datastore", "datastore2", "datastore2+", "datastore3+-@", "data store2+". 1: https://issues.redhat.com/browse/RHEL-134127 2: https://issues.redhat.com/browse/RHEL-133729#comment-28604072 Signed-off-by: Michal Privoznik Reviewed-by: Jiri Denemark Reviewed-by: Richard W.M. Jones --- src/esx/esx_util.c | 17 +++++++++++++++++ src/esx/esx_util.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c index 7ee0e5f7c0..e47ea36730 100644 --- a/src/esx/esx_util.c +++ b/src/esx/esx_util.c @@ -448,3 +448,20 @@ esxUtil_EscapeForXml(const char *string) =20 return virBufferContentAndReset(&buffer); } + + + +/* esxUtil_EscapeInventoryObject: + * @buf: the buffer to append to + * @string: the string argument which will be URI-encoded + * + * URI-encode given @string TWICE and append the result to the @buf. + */ +void +esxUtil_EscapeInventoryObject(virBuffer *buf, const char *string) +{ + g_autoptr(GString) escaped =3D g_string_new(NULL); + + g_string_append_uri_escaped(escaped, string, NULL, false); + virBufferURIEncodeString(buf, escaped->str); +} diff --git a/src/esx/esx_util.h b/src/esx/esx_util.h index 58bc44e744..29f01e0c15 100644 --- a/src/esx/esx_util.h +++ b/src/esx/esx_util.h @@ -22,6 +22,7 @@ #pragma once =20 #include "internal.h" +#include "virbuffer.h" #include "viruri.h" =20 #define ESX_VI_CHECK_ARG_LIST(val) \ @@ -67,3 +68,5 @@ void esxUtil_ReplaceSpecialWindowsPathChars(char *string); char *esxUtil_EscapeDatastoreItem(const char *string); =20 char *esxUtil_EscapeForXml(const char *string); + +void esxUtil_EscapeInventoryObject(virBuffer *buf, const char *string); --=20 2.52.0 From nobody Mon Feb 2 07:17:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1767862567; cv=none; d=zohomail.com; s=zohoarc; b=GIDVJsWscH+2qqzDlAiqu9l7xdHRWs6smXMoGS4XmjuEMKVqowUC0nBTD0kSV3ajLws0JUj0tIeWS71SzMgChEQABoalvhpsErc9i8yrWCZLAv2lLVW9hg8m8/N+KCkWiENgDy1NEHZ3vwhFya4jwrQBJYh7YSM3Q7YvCEJ3obw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767862567; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=udMnefgpIpEA2srUrmd+cElTICNAuDRhExQYRGmXUXw=; b=MSAHLRgLmcRhQpqPKFKNt83JpsLen7T9Hd2RhrpXAjQ69OgPVQS514ajH+N6TVCZd+X0acxZP0YchBwIBlmiKPShd72/Bp7dTm5FHg7FcnwabrDA9KrtB7JaE6gjZMUTnPpu8Vv5WDZMWMUJFK9GVLrNRqOarfv5tZkZbKc/nNs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1767862567214946.911141542879; Thu, 8 Jan 2026 00:56:07 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 50C123F37E; Thu, 8 Jan 2026 03:56:06 -0500 (EST) Received: from [172.19.199.83] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id A7F6744003; Thu, 8 Jan 2026 03:54:37 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 44D9B41B60; Thu, 8 Jan 2026 03:54:28 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 7780D43E62 for ; Thu, 8 Jan 2026 03:23:42 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-246-FCpvQm7AOzWDYnC7Z8m9qw-1; Thu, 08 Jan 2026 03:23:40 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7FDB71956094 for ; Thu, 8 Jan 2026 08:23:35 +0000 (UTC) Received: from moe (unknown [10.43.3.236]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DE10D18007D2 for ; Thu, 8 Jan 2026 08:23:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1767860622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=udMnefgpIpEA2srUrmd+cElTICNAuDRhExQYRGmXUXw=; b=dXP3neeWJ+tBhtNGjNeW9m2SefKzuhymR81ImKsTTtPn9TbAK3v8iShj/yQdFb6S1m02Ol 2vmZaYwDZ7QVwofQjWv3zew/BjBE0srIvwHXdbLAoHn7WuTZeciIlEXl9nc6EVYARCm0Tu S8uKP3DSq1dZcuGMgqoyqIBkvCb/GN8= X-MC-Unique: FCpvQm7AOzWDYnC7Z8m9qw-1 X-Mimecast-MFC-AGG-ID: FCpvQm7AOzWDYnC7Z8m9qw_1767860619 To: devel@lists.libvirt.org Subject: [PATCH 2/2] esx: URI encode inventory objects twice Date: Thu, 8 Jan 2026 09:23:24 +0100 Message-ID: <35dd27fa565a0a532b209a415ed7bfcd47d379b9.1767860579.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: HLk1QggWoiLrGhZMR8kNCp7bO_zv34czQiuBSqxnKkU_1767860619 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NDUCPWCQEXWWEXLTPRY3GYA5MUFNFWMX X-Message-ID-Hash: NDUCPWCQEXWWEXLTPRY3GYA5MUFNFWMX X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1767862568657158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik While discouraged by a KB article to use special characters in inventory object names [1], ESX won't stop you. And thus users can end up with a datastore named "datastore2+", for instance. The datastore name (and datacenter path) are important when fetching/uploading a .vmx file (used in APIs like virDomainGetXMLDesc() or virDomainDefineXML()). And while we do URI encode both (dcPath and dsName), encoding them once is not enough. Cole Robinson discovered [2] that they need to be URI-encoded twice. Use newly introduced esxUtil_EscapeInventoryObject() helper to encode them twice. 1: https://knowledge.broadcom.com/external/article/386368/vcenter-inventory= -object-name-with-speci.html 2: https://issues.redhat.com/browse/RHEL-133729#comment-28604072 Resolves: https://issues.redhat.com/browse/RHEL-134127 Signed-off-by: Michal Privoznik Reviewed-by: Jiri Denemark --- src/esx/esx_driver.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 9f965811b1..02f30c2b19 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2567,9 +2567,9 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int= flags) domain->conn->uri->server, domain->conn->uri->port); virBufferURIEncodeString(&buffer, directoryAndFileName); virBufferAddLit(&buffer, "?dcPath=3D"); - virBufferURIEncodeString(&buffer, priv->primary->datacenterPath); + esxUtil_EscapeInventoryObject(&buffer, priv->primary->datacenterPath); virBufferAddLit(&buffer, "&dsName=3D"); - virBufferURIEncodeString(&buffer, datastoreName); + esxUtil_EscapeInventoryObject(&buffer, datastoreName); =20 url =3D virBufferContentAndReset(&buffer); =20 @@ -3002,9 +3002,9 @@ esxDomainDefineXMLFlags(virConnectPtr conn, const cha= r *xml, unsigned int flags) =20 virBufferURIEncodeString(&buffer, escapedName); virBufferAddLit(&buffer, ".vmx?dcPath=3D"); - virBufferURIEncodeString(&buffer, priv->primary->datacenterPath); + esxUtil_EscapeInventoryObject(&buffer, priv->primary->datacenterPath); virBufferAddLit(&buffer, "&dsName=3D"); - virBufferURIEncodeString(&buffer, datastoreName); + esxUtil_EscapeInventoryObject(&buffer, datastoreName); =20 url =3D virBufferContentAndReset(&buffer); =20 --=20 2.52.0