1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-02-08 03:54:20 +01:00

Better grouping.

- group $sl filtering and validation.

- this commit might change replies sent to clients,
	since the validation check is done eaerlier now,
	and we might return S_MISSING_PARAM before S_BAD_OTP for example.

- this should really not cause any issues though,
	the order of which error is raised first should not matter to clients.
This commit is contained in:
Jean Paul Galea 2015-07-21 21:17:59 +00:00
parent 1e4453ccdf
commit 1e799aa6e5

View File

@ -150,6 +150,11 @@ if (!isset($sl) || $sl == '')
{
$sl = $baseParams['__YKVAL_SYNC_DEFAULT_LEVEL__'];
}
if ($sl && (preg_match("/^[0-9]+$/", $sl)==0 || ($sl<0 || $sl>100)))
{
$myLog->log(LOG_NOTICE, 'SL is provided but not correct');
sendResp(S_MISSING_PARAMETER, $myLog);
}
if (!isset($timeout) || $timeout == '')
{
@ -200,12 +205,6 @@ if (isset($nonce) && (strlen($nonce) < 16 || strlen($nonce) > 40))
sendResp(S_MISSING_PARAMETER, $myLog);
}
if ($sl && (preg_match("/^[0-9]+$/", $sl)==0 || ($sl<0 || $sl>100)))
{
$myLog->log(LOG_NOTICE, 'SL is provided but not correct');
sendResp(S_MISSING_PARAMETER, $myLog);
}
/**
* Timestamp parameter is not checked since current protocol
* says that 1 means request timestamp and anything else is discarded.