1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2024-12-01 15:24:12 +01:00

Version-tag challenge-response state file contents.

Helps in case we ever want to change the file format.
This commit is contained in:
Fredrik Thulin 2011-03-17 16:11:56 +01:00
parent ab47c06c20
commit fe12e98e38

4
util.c
View File

@ -200,7 +200,7 @@ load_chalresp_state(FILE *f, CR_STATE *state)
* 40 is twice the size of CR_RESPONSE_SIZE * 40 is twice the size of CR_RESPONSE_SIZE
* (twice because we hex encode the challenge and response) * (twice because we hex encode the challenge and response)
*/ */
r = fscanf(f, "%126[0-9a-z]:%40[0-9a-z]:%d", &challenge_hex, &response_hex, &slot); r = fscanf(f, "v1:%126[0-9a-z]:%40[0-9a-z]:%d", &challenge_hex, &response_hex, &slot);
D(("Challenge: %s, response: %s, slot: %d", challenge_hex, response_hex, slot)); D(("Challenge: %s, response: %s, slot: %d", challenge_hex, response_hex, slot));
if (r != 3) if (r != 3)
goto out; goto out;
@ -255,7 +255,7 @@ write_chalresp_state(FILE *f, CR_STATE *state)
if (ftruncate(fd, 0)) if (ftruncate(fd, 0))
goto out; goto out;
fprintf(f, "%s:%s:%d\n", challenge_hex, response_hex, state->slot); fprintf(f, "v1:%s:%s:%d\n", challenge_hex, response_hex, state->slot);
if (fsync(fd) < 0) if (fsync(fd) < 0)
goto out; goto out;