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

Refactor.

- getLocalParams() returns array or bool false on failure.
This commit is contained in:
Jean Paul Galea 2015-07-17 23:12:59 +02:00
parent e604477fff
commit ed169f49c5
3 changed files with 3 additions and 6 deletions

View File

@ -84,8 +84,7 @@ if (! $sync->isConnected()) {
}
foreach($yubikeys as $key) {
$localParams = $sync->getLocalParams($key);
if (!$localParams) {
if (($localParams = $sync->getLocalParams($key)) === FALSE) {
logdie($myLog, 'ERROR Invalid Yubikey ' . $key);
}

View File

@ -116,8 +116,7 @@ foreach (array('modified','yk_counter', 'yk_use', 'yk_high', 'yk_low') as $param
// get local counter data
$yk_publicname = $syncParams['yk_publicname'];
$localParams = $sync->getLocalParams($yk_publicname);
if (!$localParams)
if (($localParams = $sync->getLocalParams($yk_publicname)) === FALSE)
{
$myLog->log(LOG_NOTICE, 'Invalid Yubikey ' . $yk_publicname);
sendResp(S_BACKEND_ERROR, $myLog);

View File

@ -282,8 +282,7 @@ $myLog->log(LOG_DEBUG, "Decrypted OTP:", $otpinfo);
// get Yubikey from DB
$yk_publicname = substr($otp, 0, strlen ($otp) - TOKEN_LEN);
$localParams = $sync->getLocalParams($yk_publicname);
if (!$localParams)
if (($localParams = $sync->getLocalParams($yk_publicname)) === FALSE)
{
$myLog->log(LOG_NOTICE, "Invalid Yubikey $yk_publicname");
sendResp(S_BACKEND_ERROR, $myLog, $apiKey);