From 3572410b3016157ed29a6a9fdb8a9c75634c549a Mon Sep 17 00:00:00 2001 From: Jean Paul Galea Date: Tue, 21 Jul 2015 21:26:58 +0000 Subject: [PATCH] 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. --- ykval-verify.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ykval-verify.php b/ykval-verify.php index 55ce004..ab0c72a 100644 --- a/ykval-verify.php +++ b/ykval-verify.php @@ -160,6 +160,11 @@ if (!isset($timeout) || $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 == '') { @@ -188,12 +193,6 @@ if ($client <= 0) 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) { $myLog->log(LOG_NOTICE, 'NONCE is provided but not correct');