1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-02-01 01:52:18 +01:00

fix fast or secure strings as sl

move transformation of strings for sync and default values for sync and
timeout to before sanity checking.
This commit is contained in:
Klas Lindfors 2012-02-22 14:27:24 +01:00
parent 68da200795
commit da24a3fe30

View File

@ -74,6 +74,12 @@ if ($protocol_version>=2.0) {
*/ */
/* Change default protocol "strings" to numeric values */
if (strcasecmp($sl, 'fast')==0) $sl=$baseParams['__YKVAL_SYNC_FAST_LEVEL__'];
if (strcasecmp($sl, 'secure')==0) $sl=$baseParams['__YKVAL_SYNC_SECURE_LEVEL__'];
if (!$sl) $sl=$baseParams['__YKVAL_SYNC_DEFAULT_LEVEL__'];
if (!$timeout) $timeout=$baseParams['__YKVAL_SYNC_DEFAULT_TIMEOUT__'];
if ($otp == '') { if ($otp == '') {
$myLog->log(LOG_NOTICE, 'OTP is missing'); $myLog->log(LOG_NOTICE, 'OTP is missing');
sendResp(S_MISSING_PARAMETER); sendResp(S_MISSING_PARAMETER);
@ -266,12 +272,6 @@ if (!$sync->queue($otpParams, $localParams)) {
exit; exit;
} }
/* Change default protocol "strings" to numeric values */
if (strcasecmp($sl, 'fast')==0) $sl=$baseParams['__YKVAL_SYNC_FAST_LEVEL__'];
if (strcasecmp($sl, 'secure')==0) $sl=$baseParams['__YKVAL_SYNC_SECURE_LEVEL__'];
if (!$sl) $sl=$baseParams['__YKVAL_SYNC_DEFAULT_LEVEL__'];
if (!$timeout) $timeout=$baseParams['__YKVAL_SYNC_DEFAULT_TIMEOUT__'];
$nr_servers=$sync->getNumberOfServers(); $nr_servers=$sync->getNumberOfServers();
$req_answers=ceil($nr_servers*$sl/100.0); $req_answers=ceil($nr_servers*$sl/100.0);
if ($req_answers>0) { if ($req_answers>0) {