From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id E717F1FF142 for ; Tue, 07 Apr 2026 09:50:19 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6D5A5FB4F; Tue, 7 Apr 2026 09:50:54 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup] api: node: replace trivial config change detection helper Date: Tue, 7 Apr 2026 09:50:03 +0200 Message-ID: <20260407075003.161713-1-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1775548155443 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.070 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 Message-ID-Hash: R6ZATWOWDVEQQ57J3BALOIUCBIPQ7LGC X-Message-ID-Hash: R6ZATWOWDVEQQ57J3BALOIUCBIPQ7LGC X-MailFrom: c.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Commit 1bab5905 ("pbs-config: refactor and move helper to detect config digest changes") moved the previous helper to detect config file changes. The DNS node config used its own helper for this. Remove that and use the common helper instead to align with the rest of the codebase. Signed-off-by: Christian Ebner --- src/api2/node/dns.rs | 7 +++---- src/tools/mod.rs | 9 +-------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/api2/node/dns.rs b/src/api2/node/dns.rs index 7065401ea..9ed73396d 100644 --- a/src/api2/node/dns.rs +++ b/src/api2/node/dns.rs @@ -3,6 +3,7 @@ use std::sync::{Arc, LazyLock, Mutex}; use ::serde::{Deserialize, Serialize}; use anyhow::Error; use const_format::concatcp; +use hex::FromHex; use openssl::sha; use regex::Regex; use serde_json::{json, Value}; @@ -134,11 +135,9 @@ pub fn update_dns( let _guard = MUTEX.lock(); let mut config = read_etc_resolv_conf()?; - let old_digest = config["digest"].as_str().unwrap(); + let old_digest = <[u8; 32]>::from_hex(config["digest"].as_str().unwrap())?; - if let Some(digest) = digest { - crate::tools::assert_if_modified(old_digest, &digest)?; - } + pbs_config::detect_modified_configuration_file(digest, &old_digest)?; if let Some(delete) = delete { for delete_prop in delete { diff --git a/src/tools/mod.rs b/src/tools/mod.rs index a31ae6c46..89b62f9a6 100644 --- a/src/tools/mod.rs +++ b/src/tools/mod.rs @@ -2,7 +2,7 @@ //! //! This is a collection of small and useful tools. -use anyhow::{bail, Error}; +use anyhow::Error; use std::collections::HashSet; use pbs_api_types::{ @@ -21,13 +21,6 @@ pub mod ticket; pub mod parallel_handler; -pub fn assert_if_modified(digest1: &str, digest2: &str) -> Result<(), Error> { - if digest1 != digest2 { - bail!("detected modified configuration - file changed by other user? Try again."); - } - Ok(()) -} - /// The default 2 hours are far too long for PBS pub const PROXMOX_BACKUP_TCP_KEEPALIVE_TIME: u32 = 120; pub const DEFAULT_USER_AGENT_STRING: &str = "proxmox-backup-client/1.0"; -- 2.47.3