[pve-devel] [PATCH manager 2/2] vzdump: move restricted API parameters check

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Oct 12 15:30:20 CEST 2016


for better visibility and earlier error detection
---
 PVE/API2/VZDump.pm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/PVE/API2/VZDump.pm b/PVE/API2/VZDump.pm
index 6a76096..8767aa2 100644
--- a/PVE/API2/VZDump.pm
+++ b/PVE/API2/VZDump.pm
@@ -56,6 +56,11 @@ __PACKAGE__->register_method ({
 		if $param->{stdout};
 	}
 
+	foreach my $key (qw(maxfiles tmpdir dumpdir script bwlimit ionice)) {
+	    raise_param_exc({ $key => "Only root may set this option."})
+		if defined($param->{$key}) && ($user ne 'root at pam');
+	}
+
 	# by default we set --rsyncable for gzip
 	local $ENV{GZIP} = "--rsyncable" if !$ENV{GZIP};
 
@@ -112,11 +117,6 @@ __PACKAGE__->register_method ({
 	die "you can only backup a single VM with option --stdout\n"
 	    if $param->{stdout} && scalar(@vmids) != 1;
 
-	foreach my $key (qw(maxfiles tmpdir dumpdir script bwlimit ionice)) {
-	    raise_param_exc({ $key => "Only root may set this option."})
-		if defined($param->{$key}) && ($user ne 'root at pam');	    
-	}
-
 	$rpcenv->check($user, "/storage/$param->{storage}", [ 'Datastore.AllocateSpace' ])
 	    if $param->{storage};
 
-- 
2.1.4





More information about the pve-devel mailing list