mirror of
https://github.com/Yubico/yubico-pam.git
synced 2025-02-20 21:54:16 +01:00
load_chalresp_state: Debug message was always shown.
This commit is contained in:
parent
5627bba2ba
commit
da246e240c
@ -529,7 +529,7 @@ do_challenge_response(pam_handle_t *pamh, struct cfg *cfg, const char *username)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (! load_chalresp_state(f, &state))
|
||||
if (! load_chalresp_state(f, &state, cfg->debug))
|
||||
goto out;
|
||||
|
||||
if (fclose(f) < 0) {
|
||||
|
7
util.c
7
util.c
@ -241,7 +241,7 @@ get_user_challenge_file(YK_KEY *yk, const char *chalresp_path, const char *usern
|
||||
}
|
||||
|
||||
int
|
||||
load_chalresp_state(FILE *f, CR_STATE *state)
|
||||
load_chalresp_state(FILE *f, CR_STATE *state, bool verbose)
|
||||
{
|
||||
/*
|
||||
* Load the current challenge and expected response information from a file handle.
|
||||
@ -262,11 +262,12 @@ load_chalresp_state(FILE *f, CR_STATE *state)
|
||||
*/
|
||||
r = fscanf(f, "v1:%126[0-9a-z]:%40[0-9a-z]:%d", &challenge_hex[0], &response_hex[0], &slot);
|
||||
if (r != 3) {
|
||||
D(("Could not parse contents of chalres_state file (%i)", r));
|
||||
D(("Could not parse contents of chalresp_state file (%i)", r));
|
||||
goto out;
|
||||
}
|
||||
|
||||
D(("Challenge: %s, response: %s, slot: %d", challenge_hex, response_hex, slot));
|
||||
if (verbose)
|
||||
D(("Challenge: %s, expected response: %s, slot: %d", challenge_hex, response_hex, slot));
|
||||
|
||||
if (! yubikey_hex_p(challenge_hex)) {
|
||||
D(("Invalid challenge hex input : %s", challenge_hex));
|
||||
|
2
util.h
2
util.h
@ -82,7 +82,7 @@ int generate_random(void *buf, int len);
|
||||
|
||||
int get_user_challenge_file(YK_KEY *yk, const char *chalresp_path, const char *username, char **fn);
|
||||
|
||||
int load_chalresp_state(FILE *f, CR_STATE *state);
|
||||
int load_chalresp_state(FILE *f, CR_STATE *state, bool verbose);
|
||||
int write_chalresp_state(FILE *f, CR_STATE *state);
|
||||
|
||||
int init_yubikey(YK_KEY **yk);
|
||||
|
Loading…
x
Reference in New Issue
Block a user