[pve-devel] [PATCH common] fix #5034 ldap attribute regex
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Nov 15 14:30:06 CET 2023
Am 15/11/2023 um 13:23 schrieb Markus Frank:
> Change regex from "m/^[a-zA-Z0-9]+$/" to "m/^[a-zA-Z0-9\-]+$/"
> to allow hyphen in ldap attribute names for pve & pmg.
>
> Signed-off-by: Markus Frank <m.frank at proxmox.com>
> ---
> There does not seem to be a regex for LDAP attributes in pbs.
> Should a regex be added for this?
>
> src/PVE/JSONSchema.pm | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
> index 49e0d7a..ef58b62 100644
> --- a/src/PVE/JSONSchema.pm
> +++ b/src/PVE/JSONSchema.pm
> @@ -408,7 +408,7 @@ PVE::JSONSchema::register_format('ldap-simple-attr', \&verify_ldap_simple_attr);
> sub verify_ldap_simple_attr {
> my ($attr, $noerr) = @_;
>
> - if ($attr =~ m/^[a-zA-Z0-9]+$/) {
> + if ($attr =~ m/^[a-zA-Z0-9\-]+$/) {
Pre-existing, but shouldn't the regex actually be?
$attr =~ m/^[a-zA-Z][a-zA-Z0-9\-]*$/
I.e., start with a letter and then be any of letter, digit or hyphen (minus).
CCing Christoph, you did a bit more LDAP stuff recently - opinions?
More information about the pve-devel
mailing list