kdb: The jitter offset should always be positive

Otherwise the resulting value could be outside the valid
bounds of the time value.

Related: https://pagure.io/freeipa/issue/9121

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Rob Crittenden 2022-03-31 13:40:40 -04:00 committed by Alexander Bokovoy
parent 2282509934
commit 62807654a0

View File

@ -40,7 +40,7 @@ jitter(krb5_deltat baseline, krb5_deltat *lifetime_out)
return;
}
*lifetime_out = baseline - offset % JITTER_WINDOW_SECONDS;
*lifetime_out = baseline - abs(offset) % JITTER_WINDOW_SECONDS;
}
static krb5_error_code