From d658d04acb7a2dec7b7479de9e70bc4d9117c3a8 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 2 Jul 2021 13:42:16 +0200 Subject: [PATCH] api: users: use public regex directly to parse out realm Signed-off-by: Thomas Lamprecht --- src/PVE/API2/User.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/PVE/API2/User.pm b/src/PVE/API2/User.pm index c606596..3fa1b65 100644 --- a/src/PVE/API2/User.pm +++ b/src/PVE/API2/User.pm @@ -10,6 +10,7 @@ use PVE::JSONSchema qw(get_standard_option register_standard_option); use PVE::SafeSyslog; use PVE::AccessControl; +use PVE::Auth::Plugin; use PVE::TokenConfig; use PVE::RESTHandler; @@ -197,9 +198,9 @@ __PACKAGE__->register_method ({ ]; } - my (undef, undef, $realm) = PVE::AccessControl::verify_username($user, 1); - if (defined($realm) && exists($domainids->{$realm})) { - $entry->{'realm-type'} = $domainids->{$realm}->{type}; + if ($user =~ /($PVE::Auth::Plugin::realm_regex)$/) { + my $realm = $1; + $entry->{'realm-type'} = $domainids->{$realm}->{type} if exists $domainids->{$realm}; } $entry->{userid} = $user; -- 2.39.2