mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-01-20 10:52:15 +01:00
Improve error checking of nonce.
This commit is contained in:
parent
1c7b2430cd
commit
4ac054f9cd
@ -48,8 +48,8 @@ if ($protocol_version>=2.0) {
|
||||
$extra['nonce']= $nonce;
|
||||
|
||||
/* Nonce is required from protocol 2.0 */
|
||||
if(!$nonce || strlen($nonce)<16 || strlen($nonce)>32) {
|
||||
$myLog->log(LOG_NOTICE, 'Protocol version >= 2.0. Nonce is missing');
|
||||
if(!$nonce) {
|
||||
$myLog->log(LOG_NOTICE, 'Nonce is missing and protocol version >= 2.0');
|
||||
sendResp(S_MISSING_PARAMETER, $apiKey, $extra);
|
||||
exit;
|
||||
}
|
||||
@ -84,9 +84,14 @@ if ($nonce && preg_match("/^[A-Za-z0-9]+$/", $nonce)==0) {
|
||||
$myLog->log(LOG_NOTICE, 'NONCE is provided but not correct');
|
||||
sendResp(S_MISSING_PARAMETER, $apiKey, $extra);
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (strlen($nonce) < 16 || strlen($nonce) > 32) {
|
||||
$myLog->log(LOG_NOTICE, 'Nonce too short or too long');
|
||||
sendResp(S_MISSING_PARAMETER, $apiKey, $extra);
|
||||
exit;
|
||||
}
|
||||
|
||||
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, $apiKey, $extra);
|
||||
|
Loading…
x
Reference in New Issue
Block a user