]> git.proxmox.com Git - pve-firewall.git/blobdiff - src/PVE/API2/Firewall/Groups.pm
prevent overwriting ipsets/sec. groups by renaming
[pve-firewall.git] / src / PVE / API2 / Firewall / Groups.pm
index 99ea41877cc6196bb504e5945f13bbaff045b41a..dfc181c90a2724c8ae19043e366fa4d427036108 100644 (file)
@@ -101,6 +101,11 @@ __PACKAGE__->register_method({
            raise_param_exc({ group => "Security group '$param->{rename}' does not exists" }) 
                if !$cluster_conf->{groups}->{$param->{rename}};
 
+           # prevent overwriting an existing group
+           raise_param_exc({ group => "Security group '$param->{group}' does already exist" })
+               if $cluster_conf->{groups}->{$param->{group}} &&
+               $param->{group} ne $param->{rename};
+
            my $data = delete $cluster_conf->{groups}->{$param->{rename}};
            $cluster_conf->{groups}->{$param->{group}} = $data;
            if (my $comment = delete $cluster_conf->{group_comments}->{$param->{rename}}) {