From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: Maximiliano Sandoval <m.sandoval@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH storage v2] fix #5181: pbs: store and read passwords as unicode
Date: Fri, 13 Jun 2025 15:11:59 +0200 [thread overview]
Message-ID: <s8o7c1faiq0.fsf@proxmox.com> (raw)
In-Reply-To: <20250613131125.354560-1-m.sandoval@proxmox.com>
Maximiliano Sandoval <m.sandoval@proxmox.com> writes:
> At the moment calling
> ```
> pvesm add pbs test --password="bär12345" --datastore='test' # ..other params
> ```
>
> Will result in the API handler getting the param->{passowrd} as a utf-8
> encoded string. When dumped with Debug::Peek's Dump() one can see:
>
> ```
> SV = PV(0x5a02c1a3ff10) at 0x5a02bd713670
> REFCNT = 1
> FLAGS = (POK,IsCOW,pPOK,UTF8)
> PV = 0x5a02c1a409b0 "b\xC3\xA4r12345"\0 [UTF8 "b\x{e4}r12345"]
> CUR = 9
> LEN = 11
> COW_REFCNT = 0
> ```
>
> Then when writing the file via file_set_contents (using syswrite
> internally) will result in perl encoding the password as latin1 and a
> file with contents:
>
> ```
> $ hexdump -C /etc/pve/priv/storage/test.pw
> 00000000 62 e4 72 31 32 33 34 35 |b.r12345|
> 00000008
> ```
>
> when the correct contents should have been:
> ```
> 00000000 62 c3 a4 72 31 32 33 34 35 |b..r12345|
> 00000009
> ```
>
> Later when the file is read via file_read_firstline it will result in
>
> ```
> SV = PV(0x5e8baa411090) at 0x5e8baa5a96b8
> REFCNT = 1
> FLAGS = (POK,pPOK)
> PV = 0x5e8baa43ee20 "b\xE4r12345"\0
> CUR = 8
> LEN = 81
> ```
>
> which is a different string than the original.
>
> At the moment, adding the storage will work as the utf8 password is
> still in memory, however, however subsequent uses (e.g. pvestatd) will
> fail.
>
> This patch fixes the issue by encoding the string as utf8 both when
> reading and storing it to disk. The user was able in the past to go
> around the issue by writing the right password in
> /etc/pve/priv/{storage}.pw and this fix is compatible with that.
>
> It is documented at
> https://pbs.proxmox.com/docs/backup-client.html#environment-variables
> that the Backup Server password must be valid utf-8.
>
> Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Differences from v1:
- Just the commit message
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-06-13 13:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-13 13:11 Maximiliano Sandoval
2025-06-13 13:11 ` Maximiliano Sandoval [this message]
2025-07-23 13:00 ` Shannon Sterz
2025-07-29 16:10 ` Thomas Lamprecht
2025-07-30 7:25 ` [pve-devel] superseded: " Maximiliano Sandoval
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=s8o7c1faiq0.fsf@proxmox.com \
--to=m.sandoval@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 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.