mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-02-01 10:52:18 +01:00
Refactor.
- retrieveURLasync() always returns FALSE on failure now, before it might have returned a string. - use array_shift($a) to pop first element, safer than $a[0]; - this commit might affect what is written to LOG_DEBUG, since now we only write the YK-KSM message when we are certain to have a valid response.
This commit is contained in:
parent
60a487a996
commit
c5b6b3c567
@ -161,7 +161,6 @@ function retrieveURLasync($ident, $urls, $logger, $ans_req=1, $match="^OK", $ret
|
||||
$ch[$handle] = $handle;
|
||||
}
|
||||
|
||||
$str = false;
|
||||
$ans_arr = array();
|
||||
|
||||
do
|
||||
@ -223,7 +222,7 @@ function retrieveURLasync($ident, $urls, $logger, $ans_req=1, $match="^OK", $ret
|
||||
if (count($ans_arr) > 0)
|
||||
return $ans_arr;
|
||||
|
||||
return $str;
|
||||
return false;
|
||||
}
|
||||
|
||||
function KSMdecryptOTP($urls, $logger, $curlopts)
|
||||
@ -237,15 +236,14 @@ function KSMdecryptOTP($urls, $logger, $curlopts)
|
||||
|
||||
$response = retrieveURLasync('YK-KSM', $urls, $logger, $ans_req=1, $match='^OK', $returl=False, $timeout=10, $curlopts);
|
||||
|
||||
if (is_array($response))
|
||||
if ($response === FALSE)
|
||||
{
|
||||
$response = $response[0];
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($response)
|
||||
{
|
||||
$response = array_shift($response);
|
||||
|
||||
$logger->log(LOG_DEBUG, log_format('YK-KSM response: ', $response));
|
||||
}
|
||||
|
||||
if (sscanf($response,
|
||||
'OK counter=%04x low=%04x high=%02x use=%02x',
|
||||
|
@ -454,9 +454,9 @@ class SyncLib
|
||||
*/
|
||||
$ans_arr = retrieveURLasync('YK-VAL sync', $urls, $this->myLog, $ans_req, $match='status=OK', $returl=True, $timeout, $this->curlopts);
|
||||
|
||||
if (!is_array($ans_arr)) {
|
||||
if ($ans_arr === FALSE) {
|
||||
$this->log(LOG_WARNING, 'No responses from validation server pool');
|
||||
$ans_arr=array();
|
||||
$ans_arr = array();
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user