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

Better grouping.

- same as 1e799aa6e57dffcb7baeb130919180bef22ea085.

- group $timeout 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:26:58 +00:00
parent 1e799aa6e5
commit 3572410b30

View File

@ -160,6 +160,11 @@ if (!isset($timeout) || $timeout == '')
{ {
$timeout = $baseParams['__YKVAL_SYNC_DEFAULT_TIMEOUT__']; $timeout = $baseParams['__YKVAL_SYNC_DEFAULT_TIMEOUT__'];
} }
if ($timeout && preg_match("/^[0-9]+$/", $timeout) == 0)
{
$myLog->log(LOG_NOTICE, 'timeout is provided but not correct');
sendResp(S_MISSING_PARAMETER, $myLog);
}
if ($otp == '') if ($otp == '')
{ {
@ -188,12 +193,6 @@ if ($client <= 0)
sendResp(S_MISSING_PARAMETER, $myLog); sendResp(S_MISSING_PARAMETER, $myLog);
} }
if ($timeout && preg_match("/^[0-9]+$/", $timeout) == 0)
{
$myLog->log(LOG_NOTICE, 'timeout is provided but not correct');
sendResp(S_MISSING_PARAMETER, $myLog);
}
if (isset($nonce) && preg_match("/^[A-Za-z0-9]+$/", $nonce) == 0) if (isset($nonce) && preg_match("/^[A-Za-z0-9]+$/", $nonce) == 0)
{ {
$myLog->log(LOG_NOTICE, 'NONCE is provided but not correct'); $myLog->log(LOG_NOTICE, 'NONCE is provided but not correct');