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)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 3B55276CE0 for ; Wed, 20 Oct 2021 18:05:58 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3553914B77 for ; Wed, 20 Oct 2021 18:05:28 +0200 (CEST) Received: from Jaspers-Work-MBP.local (122-116-130-228.hinet-ip.hinet.net [122.116.130.228]) by firstgate.proxmox.com (Proxmox) with ESMTP id 197F014B46 for ; Wed, 20 Oct 2021 18:05:26 +0200 (CEST) Received: by Jaspers-Work-MBP.local (Postfix, from userid 501) id AF3B94F0A50F; Wed, 20 Oct 2021 02:50:37 +0800 (CST) From: Jasper Yu <007seadog@gmail.com> To: pve-devel@lists.proxmox.com Date: Wed, 20 Oct 2021 02:50:23 +0800 Message-Id: <20211019185023.65276-2-007seadog@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20211019185023.65276-1-007seadog@gmail.com> References: <20211019185023.65276-1-007seadog@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 7 AWL 3.454 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_ADSP_CUSTOM_MED 0.001 No valid author signature, adsp_override is CUSTOM_MED FORGED_GMAIL_RCVD 1 'From' gmail.com does not match 'Received' headers FREEMAIL_FORGED_FROMDOMAIN 0.248 2nd level domains in From and EnvelopeFrom freemail headers are different FREEMAIL_FROM 0.001 Sender email is commonly abused enduser mail provider FROM_STARTS_WITH_NUMS 0.738 From: starts with several numbers HEADER_FROM_DIFFERENT_DOMAINS 0.249 From and EnvelopeFrom 2nd level mail domains are different KAM_DMARC_NONE 0.25 DKIM has Failed or SPF has failed on the message and the domain has no DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods KHOP_HELO_FCRDNS 0.398 Relay HELO differs from its IP's reverse DNS NML_ADSP_CUSTOM_MED 0.9 ADSP custom_med hit, and not from a mailing list NO_DNS_FOR_FROM 0.001 Envelope sender has no MX or A DNS records PDS_RDNS_DYNAMIC_FP 0.001 RDNS_DYNAMIC with FP steps RDNS_DYNAMIC 0.982 Delivered to internal network by host with dynamic-looking rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an 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. [accesscontrol.pm] Subject: [pve-devel] SPAM: [PATCH pve-access-control 1/1] Fixed #3686: User Removing Failure 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: , X-List-Received-Date: Wed, 20 Oct 2021 16:05:58 -0000 From: Li-Heng Yu <007seadog@gmail.com> Signed-off-by: Li-Heng Yu <007seadog@gmail.com> --- src/PVE/AccessControl.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/PVE/AccessControl.pm b/src/PVE/AccessControl.pm index fcb16bd..0d2c6c0 100644 --- a/src/PVE/AccessControl.pm +++ b/src/PVE/AccessControl.pm @@ -1628,7 +1628,10 @@ sub user_set_tfa { die "realm '$realm' does not allow removing the 2nd factor\n" if defined($user); } } else { - die "user '$userid' not found\n" if !defined($user); + # Remove user in non-TFA-enforcement realm + if (defined($data)) { + die "user '$userid' not found\n" if !defined($user); + } # Without a realm-enforced TFA setting the user can add a u2f or totp entry by themselves. # The 'yubico' type requires yubico server settings, which have to be configured on the # realm, so this is not supported here: -- 2.28.0