From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pve-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 5DC311FF15E for <inbox@lore.proxmox.com>; Tue, 25 Mar 2025 11:41:41 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C84886AFF; Tue, 25 Mar 2025 11:41:32 +0100 (CET) From: Christoph Heiss <c.heiss@proxmox.com> To: pve-devel@lists.proxmox.com Date: Tue, 25 Mar 2025 11:38:31 +0100 Message-ID: <20250325104053.491601-2-c.heiss@proxmox.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250325104053.491601-1-c.heiss@proxmox.com> References: <20250325104053.491601-1-c.heiss@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 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 Subject: [pve-devel] [PATCH access-control 1/3] access: lookup: fix undef warning for case-insensitive realms X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> Originally reported in the forum [0]. This is only a cosmetic fix and has no user-visible impact, just fixing a code warning in the syslog. Applies only for case-insensitive realms too, where Active Directory is the only type to support that. When looking up a non-existing username on case-insensitive realms, it currently returns `undef`, which then causes the following warning in the syslog: Use of uninitialized value $username in concatenation (.) or string at /usr/share/perl5/PVE/API2/AccessControl.pm line 303. authentication failure; rhost=::ffff:10.0.0.1 user= msg=user name '' is too short This now follows the logic from the common, case-sensitive path, to just return the original, given username (which is then later on validated in the auth chain). No functional changes. [0] https://forum.proxmox.com/threads/new-ad-realm-not-working-blank-username.157859/ Signed-off-by: Christoph Heiss <c.heiss@proxmox.com> --- src/PVE/AccessControl.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PVE/AccessControl.pm b/src/PVE/AccessControl.pm index 47f2d38..d1e7d56 100644 --- a/src/PVE/AccessControl.pm +++ b/src/PVE/AccessControl.pm @@ -1231,7 +1231,7 @@ sub lookup_username { die "ambiguous case insensitive match of username '$username', cannot safely grant access!\n" if scalar @matches > 1 && !$noerr; - return $matches[0] + return $matches[0] if defined($matches[0]); } return $username; -- 2.48.1 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel