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 14C6696098 for ; Wed, 28 Feb 2024 16:01:28 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id DB11FF9A6 for ; Wed, 28 Feb 2024 16:00:57 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 for ; Wed, 28 Feb 2024 16:00:54 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 0187D479FC for ; Wed, 28 Feb 2024 16:00:54 +0100 (CET) Message-ID: Date: Wed, 28 Feb 2024 16:00:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Proxmox VE development discussion , Thomas Lamprecht , Filip Schauer References: <20240109133515.63483-1-f.schauer@proxmox.com> <6eb978ee-e8ea-4b86-9b9c-b04517893f4e@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: <6eb978ee-e8ea-4b86-9b9c-b04517893f4e@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.071 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 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com, ldap.pm] Subject: Re: [pve-devel] [PATCH v2 access-control] fix #5136: ldap: Decode non-ASCII characters in attributes 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, 28 Feb 2024 15:01:28 -0000 Am 28.02.24 um 15:41 schrieb Thomas Lamprecht: > Am 09/01/2024 um 14:35 schrieb Filip Schauer: >> UTF8 decode non-ASCII characters when syncing user attributes, since >> those will be encoded later on. Without this fix the attributes were >> encoded twice, resulting in cases such as 'ü' turning into 'ü'. >> >> Signed-off-by: Filip Schauer >> --- >> Changes since v1: >> * Do not try to URI unescape the user attributes, since we do that later >> in PVE::AccessControl::parse_user_config anyways. >> >> src/PVE/Auth/LDAP.pm | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/src/PVE/Auth/LDAP.pm b/src/PVE/Auth/LDAP.pm >> index b958f2b..06177db 100755 >> --- a/src/PVE/Auth/LDAP.pm >> +++ b/src/PVE/Auth/LDAP.pm >> @@ -301,7 +301,7 @@ sub get_users { >> >> foreach my $attr (keys %$user_attributes) { >> if (my $ours = $ldap_attribute_map->{$attr}) { >> - $ret->{$username}->{$ours} = $user_attributes->{$attr}->[0]; >> + $ret->{$username}->{$ours} = Encode::decode('utf8', $user_attributes->{$attr}->[0]); Note: missing use Encode; at the beginning of the file. >> } >> } >> > > this would need a rebase, oh, and would be great if the original testers > could reconfirm the v2 approach of doing utf-8 decoding only. > Gave it a quick test and fixes issues with special characters for me. Don't forget to also use the latest master of pve-cluster, otherwise writing the user config will still do the wrong thing [0]! Both are needed to fix the issue here. I'm just wondering if we are guaranteed that the LDAP server sends UTF-8 encoded data? [0]: https://git.proxmox.com/?p=pve-cluster.git;a=commit;h=2e276ccd9beb2004ddd72396b2a9b72a288771d8