[pve-devel] [PATCH installer 3/3] auto-installer: raise minimum root password length to 8 characters
Christoph Heiss
c.heiss at proxmox.com
Mon Oct 7 11:52:02 CEST 2024
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!
More information about the pve-devel
mailing list