X-Git-Url: https://git.proxmox.com/?p=pve-access-control.git;a=blobdiff_plain;f=pveum;h=c9d602e589869300cdd699341689d56e5f6592a2;hp=7c69688c85f95ce88d317b44beec3cd489742eac;hb=7d2df2ef843095765b3e4a2da5f274ee21d28835;hpb=bdc61d7a1801e690a68a264f1c9c22963eeb5df8 diff --git a/pveum b/pveum index 7c69688..c9d602e 100755 --- a/pveum +++ b/pveum @@ -1,6 +1,7 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; use Getopt::Long; use PVE::Tools qw(run_command); use PVE::Cluster; @@ -28,19 +29,6 @@ initlog('pveum'); #fixme: logging? -die "please run as root\n" if $> != 0; - -PVE::INotify::inotify_init(); - -my $rpcenv = PVE::RPCEnvironment->init('cli'); - -$rpcenv->init_request(); -$rpcenv->set_language($ENV{LANG}); -$rpcenv->set_user('root@pam'); - -# autmatically generate the private key if it does not already exists -PVE::Cluster::gen_auth_key(); - my $read_password = sub { # return $ENV{PVE_PW_TICKET} if defined($ENV{PVE_PW_TICKET}); @@ -81,6 +69,21 @@ my $cmddef = { my $cmd = shift; +if (defined($cmd) && $cmd ne 'verifyapi' && $cmd ne 'printmanpod') { + die "please run as root\n" if $> != 0; + + PVE::INotify::inotify_init(); + + my $rpcenv = PVE::RPCEnvironment->init('cli'); + + $rpcenv->init_request(); + $rpcenv->set_language($ENV{LANG}); + $rpcenv->set_user('root@pam'); + +# autmatically generate the private key if it does not already exists + PVE::Cluster::gen_auth_key(); +} + PVE::CLIHandler::handle_cmd($cmddef, "pveum", $cmd, \@ARGV, $read_password, $0); exit 0;