public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-storage 2/2] esxi: rewrite non-UTF-8 password files
Date: Mon,  5 Oct 2026 12:55:23 +0200	[thread overview]
Message-ID: <20261005110306.2197624-3-a.bied-charreton@proxmox.com> (raw)
In-Reply-To: <20261005110306.2197624-1-a.bied-charreton@proxmox.com>

Before the previous commit, passwords containing characters in the
U+0080 to U+00FF range were written as Latin-1, whcih listvms.py and the
FUSE tool choked on. Existing storages would keep failing until their
password was set again.

The old code wrote each such character as a single byte, so a password
file that is not valid UTF-8 can only be Latin-1. Before querying the
host, rewrite such a file as UTF-8, which recovers the original password
exactly.

Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
 src/PVE/Storage/ESXiPlugin.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/PVE/Storage/ESXiPlugin.pm b/src/PVE/Storage/ESXiPlugin.pm
index 7defb7b..3c0c9e3 100644
--- a/src/PVE/Storage/ESXiPlugin.pm
+++ b/src/PVE/Storage/ESXiPlugin.pm
@@ -147,6 +147,13 @@ sub get_manifest : prototype($$$;$) {
     my $host = $scfg->{server};
     my $user = $scfg->{username};
     my $pwfile = esxi_cred_file_name($storeid);
+
+    # migrate pre-existing passwords affected by #7360
+    if (-e $pwfile) {
+        my $pw = file_get_contents($pwfile);
+        esxi_set_credentials($pw, $storeid) if !utf8::decode(my $tmp = $pw);
+    }
+
     my $json = '';
     my $errmsg = '';
     eval {
-- 
2.47.3





      parent reply	other threads:[~2026-10-05 11:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-05 10:55 [PATCH pve-storage 0/2] fix #7360: esxi: write password file as Arthur Bied-Charreton
2026-10-05 10:55 ` [PATCH pve-storage 1/2] fix #7360: esxi: store password file as utf-8 Arthur Bied-Charreton
2026-10-05 10:55 ` Arthur Bied-Charreton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261005110306.2197624-3-a.bied-charreton@proxmox.com \
    --to=a.bied-charreton@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal