mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-02-01 01:52:18 +01:00
Don't hard code prefix length.
This commit is contained in:
parent
f9c7782eb1
commit
e5e3cff2c6
@ -14,7 +14,7 @@ define('TS_SEC', 1/8);
|
||||
define('TS_REL_TOLERANCE', 0.3);
|
||||
define('TS_ABS_TOLERANCE', 20);
|
||||
|
||||
define('DEVICE_ID_LEN', 12);
|
||||
define('TOKEN_LEN', 32);
|
||||
|
||||
function unescape($s) {
|
||||
return str_replace('\\', "", $s);
|
||||
|
@ -75,7 +75,13 @@ debug($otpinfo);
|
||||
|
||||
//// Get Yubikey from DB
|
||||
//
|
||||
$devId = substr($otp, 0, DEVICE_ID_LEN);
|
||||
if (strlen($otp) <= TOKEN_LEN) {
|
||||
debug('Too short OTP: ' . $otp);
|
||||
sendResp(S_BAD_OTP);
|
||||
exit;
|
||||
}
|
||||
|
||||
$devId = substr($otp, 0, strlen ($otp) - TOKEN_LEN);
|
||||
$ad = getAuthData($conn, $devId);
|
||||
if (!is_array($ad)) {
|
||||
debug('Invalid Yubikey ' . $devId);
|
||||
|
Loading…
x
Reference in New Issue
Block a user