From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <t.lamprecht@proxmox.com>
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 88321620D8
 for <pve-devel@lists.proxmox.com>; Wed, 19 Jan 2022 14:52:08 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 7E488197BE
 for <pve-devel@lists.proxmox.com>; Wed, 19 Jan 2022 14:52:08 +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 id 7F316197B0
 for <pve-devel@lists.proxmox.com>; Wed, 19 Jan 2022 14:52:07 +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 BBBEE46075
 for <pve-devel@lists.proxmox.com>; Wed, 19 Jan 2022 14:52:06 +0100 (CET)
Message-ID: <9b33081c-78cc-66f5-a1c5-8b817d7cdaf2@proxmox.com>
Date: Wed, 19 Jan 2022 14:52:05 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101
 Thunderbird/97.0
Content-Language: en-US
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 markus frank <m.frank@proxmox.com>
References: <20220119120422.26517-1-m.frank@proxmox.com>
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
In-Reply-To: <20220119120422.26517-1-m.frank@proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.058 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -0.001 Looks like a legit reply (A)
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pve-devel] [PATCH container 1/1] fix #3748 changed
 regex-pattern to accept escape sequences on Comma
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>
X-List-Received-Date: Wed, 19 Jan 2022 13:52:08 -0000

On 19.01.22 13:21, Markus Frank wrote:
> Correction: Patch for access-control and not for container
> 

also missing your SOB (sign-off).

side note: our webmailer is currently a bit broken on reply, i.e., it omits the
In-Reply-to header which in turn breaks threading for all with a sensible MUA.
Thus I'd appreciate it greatly if you'd use another MTA/MUA that avoids such
issues for now, e.g., thunderbird or claws if you prefer graphical or (neo)mutt
or aerc if you prefer terminal based ones. On the long run keeping up with our
and other opensource's projects development lists via webmail alone may get
cumbersome fast anyway ;-)


>> On 19.01.2022 13:04 markus frank <m.frank@proxmox.com> wrote:
>>
>>  
>> old-pattern: '\w+=[^,]+(,\s*\w+=[^,]+)*'

I mean, I can see that from the commit diff, so not really adding much here

>> the old pattern didn't allow LDAP base domain name to be like: dc=first\, second, dc=com

that is good info though, maybe add that commas in LDAP paths require
escaping and so we explicitly allow for a escaped comma only.

>> new-pattern: qr(\w+=([^,\\]|\\,)+(,\s*\w+=([^,\\]|\\,)+)*),

abobe again a bit redundant with the diff.

>> ---
>>  src/PVE/Auth/LDAP.pm | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/PVE/Auth/LDAP.pm b/src/PVE/Auth/LDAP.pm
>> index 97d0778..ad23cb2 100755
>> --- a/src/PVE/Auth/LDAP.pm
>> +++ b/src/PVE/Auth/LDAP.pm
>> @@ -19,7 +19,7 @@ sub properties {
>>  	base_dn => {
>>  	    description => "LDAP base domain name",
>>  	    type => 'string',
>> -	    pattern => '\w+=[^,]+(,\s*\w+=[^,]+)*',
>> +	    pattern => qr(\w+=([^,\\]|\\,)+(,\s*\w+=([^,\\]|\\,)+)*),

nit: we do not really use () for quoted regex operator, I'd rather prefer one
of qr// qr!! or qr@@ which all have some use in our code base, IIRC.

Further, this disallows now some values including a \ that where ok previous,
is that intended or what's the idea here? The commit message does not talks about
it.

>>  	    optional => 1,
>>  	    maxLength => 256,
>>  	},
>> @@ -33,7 +33,7 @@ sub properties {
>>  	bind_dn => {
>>  	    description => "LDAP bind domain name",
>>  	    type => 'string',
>> -	    pattern => '\w+=[^,]+(,\s*\w+=[^,]+)*',
>> +	    pattern => qr(\w+=([^,\\]|\\,)+(,\s*\w+=([^,\\]|\\,)+)*),
>>  	    optional => 1,
>>  	    maxLength => 256,
>>  	},
>> @@ -91,7 +91,7 @@ sub properties {
>>  	    description => "LDAP base domain name for group sync. If not set, the"
>>  		." base_dn will be used.",
>>  	    type => 'string',
>> -	    pattern => '\w+=[^,]+(,\s*\w+=[^,]+)*',
>> +	    pattern => qr(\w+=([^,\\]|\\,)+(,\s*\w+=([^,\\]|\\,)+)*),
>>  	    optional => 1,
>>  	    maxLength => 256,
>>  	},
>> -- 
>> 2.30.2
>>