and only pass perm to the api call if it is not empty Signed-off-by: Dominik Csapak <d.csa...@proxmox.com> --- the optional privs parameter is needed for non-pve environments, where no privs exist src/PVE/CLI/termproxy.pm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/PVE/CLI/termproxy.pm b/src/PVE/CLI/termproxy.pm index fc98976..dae1dfd 100644 --- a/src/PVE/CLI/termproxy.pm +++ b/src/PVE/CLI/termproxy.pm @@ -26,11 +26,15 @@ sub verify_ticket { my $ua = LWP::UserAgent->new(); - my $res = $ua->post ('http://localhost:85/api2/json/access/ticket', Content => { - username => $user, - password => $ticket, - path => $path, - privs => $perm, }); + my $params = { + username => $user, + password => $ticket, + path => $path, + }; + + $params->{privs} = $perm if $perm; + + my $res = $ua->post ('http://localhost:85/api2/json/access/ticket', Content => $params); if (!$res->is_success) { die "Authentication failed: '$res->status_line'\n"; @@ -214,11 +218,13 @@ __PACKAGE__->register_method ({ type => 'string', description => "The Authentication path. (default: '".DEFAULT_PATH."')", default => DEFAULT_PATH, + optional => 1, }, perm => { type => 'string', description => "The Authentication Permission. (default: '".DEFAULT_PERM."')", default => DEFAULT_PERM, + optional => 1, }, 'extra-args' => get_standard_option('extra-args'), }, -- 2.11.0 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel