mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-03-04 03:29:18 +01:00
Refactor.
- use simple comparisons and ctype for validation, less resource intensive than regex.
This commit is contained in:
parent
dedfa0a149
commit
742a0d73c2
@ -110,18 +110,23 @@ $sync->addField('otp', $syncParams['otp']);
|
||||
#
|
||||
|
||||
foreach (array('modified') as $param) {
|
||||
if (preg_match("/^[0-9]+$/", $syncParams[$param])==0) {
|
||||
if ($syncParams[$param] !== '' && ctype_digit($syncParams[$param]))
|
||||
continue;
|
||||
|
||||
$myLog->log(LOG_NOTICE, 'Input parameters ' . $param . ' not correct');
|
||||
sendResp(S_MISSING_PARAMETER, $myLog, $apiKey);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (array('yk_counter', 'yk_use', 'yk_high', 'yk_low') as $param) {
|
||||
if (preg_match("/^(-1|[0-9]+)$/", $syncParams[$param])==0) {
|
||||
if ($syncParams[$param] === '-1')
|
||||
continue;
|
||||
|
||||
if ($syncParams[$param] !== '' && ctype_digit($syncParams[$param]))
|
||||
continue;
|
||||
|
||||
$myLog->log(LOG_NOTICE, 'Input parameters ' . $param . ' not correct');
|
||||
sendResp(S_MISSING_PARAMETER, $myLog, $apiKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user