From 283ac2bae1e06466a5568ee547e9f0592d7f063a Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 6 Mar 2020 11:05:36 +0100 Subject: [PATCH] add ldap-simple-attr from pmg we also need it in pve Signed-off-by: Dominik Csapak --- src/PVE/JSONSchema.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm index 599dd09..fa405ac 100644 --- a/src/PVE/JSONSchema.pm +++ b/src/PVE/JSONSchema.pm @@ -265,6 +265,19 @@ sub pve_verify_ip { return $ip; } +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]+$/) { + return $attr; + } + + die "value '$attr' does not look like a simple ldap attribute name\n" if !$noerr; + + return undef; +} + my $ipv4_mask_hash = { '0.0.0.0' => 0, '128.0.0.0' => 1,