RESTServer: Clarify error message when time skew is too great

deab21e091 did only half the job
This commit is contained in:
Maxime Besson 2020-04-28 15:49:19 +02:00
parent 393a8f831e
commit 8eb9120af7

View File

@ -226,12 +226,16 @@ sub newSession {
my $force = 0;
if ( my $s = delete $infos->{__secret} ) {
my $t;
if ( $t =
$self->conf->{cipher}->decrypt($s)
and $t <= time + $self->conf->{restClockTolerance}
and $t > time - $self->conf->{restClockTolerance} )
{
$force = 1;
if ( $t = $self->conf->{cipher}->decrypt($s) ) {
if ( $t <= time + $self->conf->{restClockTolerance}
and $t > time - $self->conf->{restClockTolerance} )
{
$force = 1;
}
else {
$self->userLogger->error( 'Clock drift between servers is'
. ' beyond tolerance, force denied.' );
}
}
else {
$self->userLogger->error('Bad key, force denied');