4 ms·
Ah, indeed. There's a seperate function for HOTP: https://github.com/google/google-authenticator/blob/3fb90bdae68f21477b5f97978641497d1048ce37/libpam/src/pam_g
by e12e 11y ago
Ah, indeed. There's a seperate function for HOTP:
https://github.com/google/google-authenticator/blob/3fb90bdae68f21477b5f97978641497d1048ce37/libpam/src/pam_google_authenticator.c#L1334 https://github.com/google/google-authenticator/blob/3fb90bda...
And of course the switch statement that handles the core logic starts by checking scratch codes, and if that doesn't work, proceeds to check TOTP/HOTP:
https://github.com/google/google-authenticator/blob/3fb90bdae68f21477b5f97978641497d1048ce37/libpam/src/pam_google_authenticator.c#L1582 https://github.com/google/google-authenticator/blob/3fb90bda...
I'm not a big fan of this style:
https://github.com/google/google-authenticator/blob/3fb90bdae68f21477b5f97978641497d1048ce37/libpam/src/pam_google_authenticator.c#L901 https://github.com/google/google-authenticator/blob/3fb90bda...
But at least there's a comment documenting the magic return code (#DEFINE VALID_SCRATCH_CODE = 0, or an enum, or basically anything else, anyone?):
/* Checks for possible use of scratch codes. Returns -1 on error, 0 on success,
* and 1, if no scratch code had been entered, and subsequent tests should be
* applied. */