X-Git-Url: https://git.proxmox.com/?p=pve-access-control.git;a=blobdiff_plain;f=PVE%2FAPI2%2FAccessControl.pm;h=5f859197446655436e58501ca282683ddc8c2534;hp=8daf10cf5f9763750af85cb70b7126d259bde296;hb=e4f8fc2e7e5f31691629a5361000636f8a2b2398;hpb=6126ab75a0837298427491ea64b9b2e1139c6ba6 diff --git a/PVE/API2/AccessControl.pm b/PVE/API2/AccessControl.pm index 8daf10c..5f85919 100644 --- a/PVE/API2/AccessControl.pm +++ b/PVE/API2/AccessControl.pm @@ -2,7 +2,6 @@ package PVE::API2::AccessControl; use strict; use warnings; -use Time::HiRes qw(usleep gettimeofday tv_interval); use PVE::Exception qw(raise raise_perm_exc); use PVE::SafeSyslog; @@ -265,9 +264,6 @@ __PACKAGE__->register_method ({ my $rpcenv = PVE::RPCEnvironment::get(); my $res; - - my $starttime = [gettimeofday]; - eval { # test if user exists and is enabled $rpcenv->check_user_enabled($username); @@ -283,12 +279,7 @@ __PACKAGE__->register_method ({ my $clientip = $rpcenv->get_client_ip() || ''; syslog('err', "authentication failure; rhost=$clientip user=$username msg=$err"); # do not return any info to prevent user enumeration attacks - # always try to delay exactly 3 seconds to prevent timing attacks - my $elapsed; - while (($elapsed = tv_interval($starttime)) < 3) { - usleep(int((3 - $elapsed)*1000000)); - } - die "authentication failure\n"; + die PVE::Exception->new("authentication failure\n", code => 401); } $res->{cap} = &$compute_api_permission($rpcenv, $username);