From 888a372f6416cef55e1edf2212cb1e114f0fd417 Mon Sep 17 00:00:00 2001 From: Olov Danielson Date: Mon, 25 Jan 2010 14:55:05 +0000 Subject: [PATCH] Use -1 in yk_counter etc. to indicate yubikey discovered in protocol --- ykval-sync.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ykval-sync.php b/ykval-sync.php index a6a10c4..e11c394 100644 --- a/ykval-sync.php +++ b/ykval-sync.php @@ -80,8 +80,16 @@ $sync->addField('otp', $syncParams['otp']); # Verify correctness of input parameters # -foreach (array('modified', 'yk_counter', 'yk_use', 'yk_high', 'yk_low') as $param) { - if (preg_match("/^[0-9]*$/", $syncParams[$param])==0) { +foreach (array('modified') as $param) { + if (preg_match("/^[0-9]+$/", $syncParams[$param])==0) { + $myLog->log(LOG_NOTICE, 'Input parameters ' . $param . ' not correct'); + sendResp(S_MISSING_PARAMETER, $apiKey); + exit; + } +} + +foreach (array('yk_counter', 'yk_use', 'yk_high', 'yk_low') as $param) { + if (preg_match("/^(-1|[0-9]+)$/", $syncParams[$param])==0) { $myLog->log(LOG_NOTICE, 'Input parameters ' . $param . ' not correct'); sendResp(S_MISSING_PARAMETER, $apiKey); exit;