[pve-devel] [PATCH manager 1/2] pve7to8: refactor user.cfg loop

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Jun 13 13:50:23 CEST 2023


next patch adds acl-related checks

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 PVE/CLI/pve7to8.pm | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/PVE/CLI/pve7to8.pm b/PVE/CLI/pve7to8.pm
index 6b51e98eb..7dc66499a 100644
--- a/PVE/CLI/pve7to8.pm
+++ b/PVE/CLI/pve7to8.pm
@@ -720,17 +720,17 @@ sub check_custom_pool_roles {
 	}
 
 	my $et = shift @data;
-	next if $et ne 'role';
-
-	my ($role, $privlist) = @data;
-	if (!PVE::AccessControl::verify_rolename($role, 1)) {
-	    warn "user config - ignore role '$role' - invalid characters in role name\n";
-	    next;
-	}
+	if ($et eq 'role') {
+	    my ($role, $privlist) = @data;
+	    if (!PVE::AccessControl::verify_rolename($role, 1)) {
+		warn "user config - ignore role '$role' - invalid characters in role name\n";
+		next;
+	    }
 
-	$roles->{$role} = {} if !$roles->{$role};
-	foreach my $priv (split_list($privlist)) {
-	    $roles->{$role}->{$priv} = 1;
+	    $roles->{$role} = {} if !$roles->{$role};
+	    foreach my $priv (split_list($privlist)) {
+		$roles->{$role}->{$priv} = 1;
+	    }
 	}
     }
 
-- 
2.39.2






More information about the pve-devel mailing list