[pve-devel] applied: [PATCH master/stable-5 access-control] API: fix calls to raise_param_exc

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Nov 14 11:59:43 CET 2019


On 11/14/19 11:00 AM, Fabian Grünbichler wrote:
> the parameter needs to be a hash reference, not a hash.
> 
> Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
> ---
> 
> Notes:
>     checked other code, seems like this was the only instance of mis-use.
> 
>  PVE/API2/AccessControl.pm | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/PVE/API2/AccessControl.pm b/PVE/API2/AccessControl.pm
> index c2324e8..b3fbe6d 100644
> --- a/PVE/API2/AccessControl.pm
> +++ b/PVE/API2/AccessControl.pm
> @@ -6,7 +6,7 @@ use warnings;
>  use JSON;
>  use MIME::Base64;
>  
> -use PVE::Exception qw(raise raise_perm_exc);
> +use PVE::Exception qw(raise raise_perm_exc raise_param_exc);
>  use PVE::SafeSyslog;
>  use PVE::RPCEnvironment;
>  use PVE::Cluster qw(cfs_read_file);
> @@ -532,7 +532,7 @@ __PACKAGE__->register_method ({
>  
>  	# Regular users need to confirm their password to change u2f settings.
>  	if ($authuser ne 'root at pam') {
> -	    raise_param_exc('password' => 'password is required to modify u2f data')
> +	    raise_param_exc({ 'password' => 'password is required to modify u2f data' })
>  		if !defined($password);
>  	    my $domain_cfg = cfs_read_file('domains.cfg');
>  	    my $cfg = $domain_cfg->{ids}->{$realm};
> @@ -564,7 +564,7 @@ __PACKAGE__->register_method ({
>  		return $challenge;
>  	    }
>  	} elsif ($action eq 'confirm') {
> -	    raise_param_exc('response' => "confirm action requires the 'response' parameter to be set")
> +	    raise_param_exc({ 'response' => "confirm action requires the 'response' parameter to be set" })
>  		if !defined($response);
>  
>  	    my ($type, $u2fdata) = PVE::AccessControl::user_get_tfa($userid, $realm);
> 

applied, thanks!





More information about the pve-devel mailing list