public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
To: Christoph Heiss <c.heiss@proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH installer 3/3] auto-installer: raise minimum root password length to 8 characters
Date: Mon, 7 Oct 2024 11:55:19 +0200	[thread overview]
Message-ID: <d44d5b22-6a90-4475-a84c-f4158c7bed63@proxmox.com> (raw)
In-Reply-To: <uelwwno57upolnivifvljitln7eiie24dokw2cagrt5cllx27i@egnwcqjkabzx>

On 10/7/24 11:52, Christoph Heiss wrote:
> Thanks for the review!
> 
> On Mon, Oct 07, 2024 at 11:49:02AM GMT, Stefan Hanreich wrote:
>> On 10/7/24 11:22, Christoph Heiss wrote:
> [..]
>>> @@ -309,6 +310,10 @@ fn verify_root_password_settings(answer: &Answer) -> Result<()> {
>>>      } else if answer.global.root_password.is_none() && answer.global.root_password_hashed.is_none()
>>>      {
>>>          bail!("One of `global.root_password` or `global.root_password_hashed` must be set");
>>> +    } else if answer.global.root_password.is_some()
>>> +        && answer.global.root_password.as_ref().map(|s| s.len()) < Some(ROOT_PASSWORD_MIN_LENGTH)
>>> +    {
>>> +        bail!("`global.root_password` must be at least {ROOT_PASSWORD_MIN_LENGTH} characters long");
>>>      } else {
>>>          Ok(())
>>>      }
>>
>> maybe match is better at this point?
>>
>> Something like
>>
>> match (answer.global.root_password, answer.global.root_password_hashed) {
>>   [..]
>>   (Some(password), _) if password.len() < ROOT_PASSWORD_MIN_LENGTH,
>>   [..]
>> }
>>
> 
> I'll rework it a bit, match definitely seems like the better fit here!

I also thought about suggesting an Enum here like

enum AnswerPassword {
  Raw(...)
  Hashed(...)
}

But that's probably a bit more involved and idk how it would work with
the answer file format, so hard for me to tell if feasible with the
current state of things


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2024-10-07  9:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-07  9:22 [pve-devel] [PATCH installer 0/3] " Christoph Heiss
2024-10-07  9:22 ` [pve-devel] [PATCH installer 1/3] proxinstall: " Christoph Heiss
2024-10-07  9:22 ` [pve-devel] [PATCH installer 2/3] tui: " Christoph Heiss
2024-10-07  9:22 ` [pve-devel] [PATCH installer 3/3] auto-installer: " Christoph Heiss
2024-10-07  9:49   ` Stefan Hanreich
2024-10-07  9:52     ` Christoph Heiss
2024-10-07  9:55       ` Stefan Hanreich [this message]
2024-10-07 10:02         ` Christoph Heiss
2024-10-07 10:39           ` Stefan Hanreich

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=d44d5b22-6a90-4475-a84c-f4158c7bed63@proxmox.com \
    --to=s.hanreich@proxmox.com \
    --cc=c.heiss@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