From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id E7AB11FF15F for ; Mon, 7 Oct 2024 11:55:28 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id AD9813B1E9; Mon, 7 Oct 2024 11:55:52 +0200 (CEST) Message-ID: Date: Mon, 7 Oct 2024 11:55:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Christoph Heiss References: <20241007092218.723938-1-c.heiss@proxmox.com> <20241007092218.723938-4-c.heiss@proxmox.com> <7cb448b4-a68a-41ea-b874-5bc1bff97140@proxmox.com> Content-Language: en-US From: Stefan Hanreich In-Reply-To: X-SPAM-LEVEL: Spam detection results: 0 AWL 0.631 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH installer 3/3] auto-installer: raise minimum root password length to 8 characters X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Cc: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" 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