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 848FE1FF38E for ; Tue, 28 May 2024 10:14:02 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 864C910751; Tue, 28 May 2024 10:14:14 +0200 (CEST) From: Christoph Heiss To: pve-devel@lists.proxmox.com Date: Tue, 28 May 2024 10:13:47 +0200 Message-ID: <20240528081359.832986-7-c.heiss@proxmox.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240528081359.832986-1-c.heiss@proxmox.com> References: <20240528081359.832986-1-c.heiss@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.012 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH installer 6/7] auto-installer: validate `global.mailto` answer option 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Signed-off-by: Christoph Heiss --- proxmox-auto-installer/src/utils.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs index f752924..7241eec 100644 --- a/proxmox-auto-installer/src/utils.rs +++ b/proxmox-auto-installer/src/utils.rs @@ -1,4 +1,4 @@ -use anyhow::{bail, Context as _, Result}; +use anyhow::{bail, Context, Result}; use clap::ValueEnum; use glob::Pattern; use log::info; @@ -9,7 +9,7 @@ use crate::{ udevinfo::UdevInfo, }; use proxmox_installer_common::{ - options::{FsType, NetworkOptions, ZfsChecksumOption, ZfsCompressOption}, + options::{email_validate, FsType, NetworkOptions, ZfsChecksumOption, ZfsCompressOption}, setup::{InstallConfig, InstallZfsOption, LocaleInfo, RuntimeInfo, SetupInfo}, }; use serde::{Deserialize, Serialize}; @@ -272,7 +272,10 @@ fn get_first_selected_disk(config: &InstallConfig) -> usize { .expect("could not parse key to usize") } -fn verify_locale_settings(answer: &Answer, locales: &LocaleInfo) -> Result<()> { +fn verify_global_settings(answer: &Answer, locales: &LocaleInfo) -> Result<()> { + info!("Verifying global settings"); + email_validate(&answer.global.mailto).with_context(|| answer.global.mailto.clone())?; + info!("Verifying locale settings"); if !locales .countries @@ -315,7 +318,7 @@ pub fn parse_answer( let network_settings = get_network_settings(answer, udev_info, runtime_info, setup_info)?; - verify_locale_settings(answer, locales)?; + verify_global_settings(answer, locales)?; let mut config = InstallConfig { autoreboot: 1_usize, -- 2.44.0 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel