mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix a signedness bug in OTP code
This bug caused negative token windows to wrap-around, causing issues with TOTP authentication and (especially) synchronization. https://fedorahosted.org/freeipa/ticket/4990 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
committed by
Petr Vobornik
parent
81df7b501e
commit
978298882b
@@ -489,7 +489,7 @@ bool otp_token_validate_berval(struct otp_token * const *tokens,
|
|||||||
if (time(&now) == (time_t) -1)
|
if (time(&now) == (time_t) -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (uint32_t i = 0, cnt = 1; cnt != 0; i++) {
|
for (ssize_t i = 0, cnt = 1; cnt != 0; i++) {
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
for (int j = 0; tokens[j] != NULL; j++) {
|
for (int j = 0; tokens[j] != NULL; j++) {
|
||||||
uint32_t *secondp = NULL;
|
uint32_t *secondp = NULL;
|
||||||
@@ -513,8 +513,8 @@ bool otp_token_validate_berval(struct otp_token * const *tokens,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Validate the positive/negative steps. */
|
/* Validate the positive/negative steps. */
|
||||||
if (!validate(tokens[j], now, i, first, secondp) &&
|
if (!validate(tokens[j], now, i, first, secondp) &&
|
||||||
!validate(tokens[j], now, 0 - i, first, secondp))
|
!validate(tokens[j], now, -i, first, secondp))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Codes validated; strip. */
|
/* Codes validated; strip. */
|
||||||
|
|||||||
Reference in New Issue
Block a user