1
0
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:
Simon Josefsson 2009-03-18 11:00:48 +00:00
parent f9c7782eb1
commit e5e3cff2c6
2 changed files with 8 additions and 2 deletions

View File

@ -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);

View File

@ -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);