1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2025-01-31 16:52:19 +01:00

always set iterations and rewind before second fscanf()

This commit is contained in:
Klas Lindfors 2013-09-18 15:34:45 +02:00
parent 6448322e06
commit 16a4dc768b

7
util.c
View File

@ -271,9 +271,8 @@ load_chalresp_state(FILE *f, CR_STATE *state, bool verbose)
yubikey_hex_decode(state->salt, salt_hex, sizeof(state->challenge));
state->salt_len = strlen(salt_hex) / 2;
state->iterations = iterations;
} else {
rewind(f);
r = fscanf(f, "v1:%126[0-9a-z]:%40[0-9a-z]:%d", challenge_hex, response_hex, &slot);
if (r != 3) {
D(("Could not parse contents of chalresp_state file (%i)", r));
@ -283,8 +282,12 @@ load_chalresp_state(FILE *f, CR_STATE *state, bool verbose)
if (verbose) {
D(("Challenge: %s, expected response: %s, slot: %d", challenge_hex, response_hex, slot));
}
iterations = CR_DEFAULT_ITERATIONS;
}
state->iterations = iterations;
if (! yubikey_hex_p(challenge_hex)) {
D(("Invalid challenge hex input : %s", challenge_hex));