[pve-devel] [PATCH storage v2] fix #5181: pbs: store and read passwords as unicode
Shannon Sterz
s.sterz at proxmox.com
Wed Jul 23 15:00:32 CEST 2025
-->8 snip 8<--
>
> - PVE::Tools::file_set_contents($pwfile, "$password\n");
> + PVE::Tools::file_set_contents($pwfile, "$password\n", undef, 1);
i know this is pre-existing, but i'd feel more comfortable forcing the
permissions here rather than depending on the default behaviour. this is
a password file after all, being explicit doesn't hurt in my opinion.
> }
>
> sub pbs_delete_password {
> @@ -109,7 +110,9 @@ sub pbs_get_password {
>
> my $pwfile = pbs_password_file_name($scfg, $storeid);
>
> - return PVE::Tools::file_read_firstline($pwfile);
> + my $contents = PVE::Tools::file_read_firstline($pwfile);
> +
> + return eval { decode('UTF-8', $contents, 1) } // $contents;
> }
>
> sub pbs_encryption_key_file_name {
other than the one comment above, consider this:
Reviewed-by: Shannon Sterz <s.sterz at proxmox.com>
Tested-by: Shannon Sterz <s.sterz at proxmox.com>
More information about the pve-devel
mailing list