From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>,
Dominik Csapak <d.csapak@proxmox.com>,
Stefan Sterz <s.sterz@proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup v2 1/2] fix #3853: api: add force option to tape key change-passphrase
Date: Mon, 14 Feb 2022 10:57:46 +0100 [thread overview]
Message-ID: <30f2c931-fdb5-03d2-de20-9c6f25a119c9@proxmox.com> (raw)
In-Reply-To: <24789990-1e3c-33ba-97d9-23b9f65e9e9f@proxmox.com>
On 14.02.22 10:20, Dominik Csapak wrote:
>> @@ -116,10 +126,29 @@ pub fn change_passphrase(
>> let key_config = match config_map.get(&fingerprint) {
>> Some(key_config) => key_config,
>> - None => bail!("tape encryption key '{}' does not exist.", fingerprint),
>> + None => bail!("tape encryption key configuration '{}' does not exist.", fingerprint),
>> + };
>> +
>> + let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
>> + let user_info = CachedUserInfo::new()?;
>> +
>> + if force && !user_info.is_superuser(&auth_id) {
>> + bail!("resetting the key's passphrase requires root privileges")
>> + }
>> +
>> + let (key, created, fingerprint) = match (force, &password) {
>> + (true, Some(_)) => bail!("password is not allowed when using force"),
>> + (false, None) => bail!("missing parameter: password"),
>
> those two errors could make use of 'ParameterError'
> see proxmox-schema/src/schema.rs
But as we do not have any `raise_param_exc` like helper switching to that is not really useful
FWICT, as the complete error message would need to be constructed manually anyway and would be
more verbose.
(btw. please trim context on reply)
prev parent reply other threads:[~2022-02-14 9:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-10 14:23 Stefan Sterz
2022-02-10 14:23 ` [pbs-devel] [PATCH proxmox-backup v2 2/2] fix #3853: tape cli: add force flag to " Stefan Sterz
2022-02-14 9:14 ` [pbs-devel] applied-series: [PATCH proxmox-backup v2 1/2] fix #3853: api: add force option to tape " Thomas Lamprecht
2022-02-14 9:20 ` [pbs-devel] " Dominik Csapak
2022-02-14 9:57 ` Thomas Lamprecht [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=30f2c931-fdb5-03d2-de20-9c6f25a119c9@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=d.csapak@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
--cc=s.sterz@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