all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH pve-storage 0/2] fix #7360: esxi: write password file as
@ 2026-10-05 10:55 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 ` [PATCH pve-storage 2/2] esxi: rewrite non-UTF-8 password files Arthur Bied-Charreton
  0 siblings, 2 replies; 3+ messages in thread
From: Arthur Bied-Charreton @ 2026-10-05 10:55 UTC (permalink / raw)
  To: pve-devel

The first commit fixes the original issue, where at creation time, the
password file would not be saved as UTF-8. This led to decoding errors
when listing VMs (and presumably in the FUSE tool, although I did not
specifically test that path).

The second commit additionally rewrites non-UTF-8-encoded password files
as UTF-8 to catch pre-existing broken password files.

More details in the messages. 

Arthur Bied-Charreton (2):
  fix #7360: esxi: store password file as utf-8
  esxi: rewrite non-UTF-8 password files

 src/PVE/Storage/ESXiPlugin.pm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

-- 
2.47.3





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH pve-storage 1/2] fix #7360: esxi: store password file as utf-8
  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 ` Arthur Bied-Charreton
  2026-10-05 10:55 ` [PATCH pve-storage 2/2] esxi: rewrite non-UTF-8 password files Arthur Bied-Charreton
  1 sibling, 0 replies; 3+ messages in thread
From: Arthur Bied-Charreton @ 2026-10-05 10:55 UTC (permalink / raw)
  To: pve-devel

The password reaches esxi_set_credentials() as a Perl string, and
file_set_contents() wrote it without encoding it. For characters in the
U+0080 to U+00FF range, like 'é', this produced Latin-1 bytes. Both
listvms.py and the FUSE tool decode the pasword file as UTF-8, so
listing guests failed with a decode error.

Force UTF-8 encoding when writing the file. Existing storages with an
affected password need to have their password set again to rewrite the
file.

Link: https://bugzilla.proxmox.com/show_bug.cgi?id=7360
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
 src/PVE/Storage/ESXiPlugin.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Storage/ESXiPlugin.pm b/src/PVE/Storage/ESXiPlugin.pm
index bc2e481..7defb7b 100644
--- a/src/PVE/Storage/ESXiPlugin.pm
+++ b/src/PVE/Storage/ESXiPlugin.pm
@@ -81,7 +81,7 @@ sub esxi_set_credentials {
     my $cred_file = esxi_cred_file_name($storeid);
     mkdir "/etc/pve/priv/storage";
 
-    PVE::Tools::file_set_contents($cred_file, $password);
+    PVE::Tools::file_set_contents($cred_file, $password, 0600, 1);
 
     return $cred_file;
 }
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH pve-storage 2/2] esxi: rewrite non-UTF-8 password files
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Arthur Bied-Charreton @ 2026-10-05 10:55 UTC (permalink / raw)
  To: pve-devel

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





^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-05 11:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH pve-storage 2/2] esxi: rewrite non-UTF-8 password files Arthur Bied-Charreton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal