[pve-devel] [PATCH common] fix #5034 ldap attribute regex

Markus Frank m.frank at proxmox.com
Wed Nov 15 13:23:34 CET 2023


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\-]+$/) {
 	return $attr;
     }
 
-- 
2.39.2






More information about the pve-devel mailing list