From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id A83536740A for ; Wed, 26 Aug 2020 10:31:27 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9889BE045 for ; Wed, 26 Aug 2020 10:31:27 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 20A1AE03C for ; Wed, 26 Aug 2020 10:31:27 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id E1418448A3 for ; Wed, 26 Aug 2020 10:31:26 +0200 (CEST) From: Thomas Lamprecht To: pbs-devel@lists.proxmox.com Date: Wed, 26 Aug 2020 10:31:12 +0200 Message-Id: <20200826083113.23822-1-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.088 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [backup.rs] Subject: [pbs-devel] applied: [PATCH backup 1/2] backup: add BACKUP_GROUP_NAME const and backup_group helper X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 08:31:27 -0000 Signed-off-by: Thomas Lamprecht --- src/backup.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/backup.rs b/src/backup.rs index cb1426ab..1b2180bc 100644 --- a/src/backup.rs +++ b/src/backup.rs @@ -120,6 +120,8 @@ macro_rules! PROXMOX_BACKUP_READER_PROTOCOL_ID_V1 { /// Unix system user used by proxmox-backup-proxy pub const BACKUP_USER_NAME: &str = "backup"; +/// Unix system group used by proxmox-backup-proxy +pub const BACKUP_GROUP_NAME: &str = "backup"; /// Return User info for the 'backup' user (``getpwnam_r(3)``) pub fn backup_user() -> Result { @@ -129,6 +131,14 @@ pub fn backup_user() -> Result { } } +/// Return Group info for the 'backup' group (``getgrnam(3)``) +pub fn backup_group() -> Result { + match nix::unistd::Group::from_name(BACKUP_GROUP_NAME)? { + Some(group) => Ok(group), + None => bail!("Unable to lookup backup user."), + } +} + mod file_formats; pub use file_formats::*; -- 2.27.0