1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-02-27 06:54:16 +01:00

Change PHP keywords to comply with PSR2

Signed-off-by: CodeLingoBot <bot@codelingo.io>
This commit is contained in:
CodeLingoBot 2019-04-05 20:13:25 +13:00
parent 18ced7b6e7
commit 3dcea401d0
14 changed files with 100 additions and 100 deletions

View File

@ -81,7 +81,7 @@ function sign($a, $apiKey, $logger)
$qs = utf8_encode($qs); $qs = utf8_encode($qs);
// base64 encoded binary digest // base64 encoded binary digest
$hmac = hash_hmac('sha1', $qs, $apiKey, TRUE); $hmac = hash_hmac('sha1', $qs, $apiKey, true);
$hmac = base64_encode($hmac); $hmac = base64_encode($hmac);
$logger->log(LOG_DEBUG, "SIGN: $qs H=$hmac"); $logger->log(LOG_DEBUG, "SIGN: $qs H=$hmac");
@ -96,17 +96,17 @@ function curl_settings($logger, $ident, $ch, $url, $timeout, $opts)
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_USERAGENT, 'YK-VAL'); curl_setopt($ch, CURLOPT_USERAGENT, 'YK-VAL');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, TRUE); curl_setopt($ch, CURLOPT_FAILONERROR, true);
if (is_array($opts) === FALSE) if (is_array($opts) === false)
{ {
$logger->log(LOG_WARN, $ident . 'curl options must be an array'); $logger->log(LOG_WARN, $ident . 'curl options must be an array');
return; return;
} }
foreach ($opts as $key => $val) foreach ($opts as $key => $val)
if (curl_setopt($ch, $key, $val) === FALSE) if (curl_setopt($ch, $key, $val) === false)
$logger->log(LOG_WARN, "$ident failed to set " . curl_opt_name($key)); $logger->log(LOG_WARN, "$ident failed to set " . curl_opt_name($key));
} }
@ -120,10 +120,10 @@ function curl_opt_name($opt)
$consts = get_defined_constants(true); $consts = get_defined_constants(true);
$consts = $consts['curl']; $consts = $consts['curl'];
$name = array_search($opt, $consts, TRUE); $name = array_search($opt, $consts, true);
// array_search may return either on failure... // array_search may return either on failure...
if ($name === FALSE || $name === NULL) if ($name === false || $name === null)
return 'curl option'; return 'curl option';
return $name; return $name;
@ -136,7 +136,7 @@ function curl_opt_name($opt)
// long as one of the URLs given work, data will be returned. If all // long as one of the URLs given work, data will be returned. If all
// URLs fail, data from some URL that did not match parameter $match // URLs fail, data from some URL that did not match parameter $match
// (defaults to ^OK) is returned, or if all URLs failed, false. // (defaults to ^OK) is returned, or if all URLs failed, false.
function retrieveURLasync($ident, $urls, $logger, $ans_req=1, $match="^OK", $returl=False, $timeout=10, $curlopts) function retrieveURLasync($ident, $urls, $logger, $ans_req=1, $match="^OK", $returl=false, $timeout=10, $curlopts)
{ {
$mh = curl_multi_init(); $mh = curl_multi_init();
$ch = array(); $ch = array();
@ -216,9 +216,9 @@ function retrieveURLasync($ident, $urls, $logger, $ans_req=1, $match="^OK", $ret
function KSMdecryptOTP($urls, $logger, $curlopts) function KSMdecryptOTP($urls, $logger, $curlopts)
{ {
$response = retrieveURLasync('YK-KSM', $urls, $logger, $ans_req=1, $match='^OK', $returl=False, $timeout=10, $curlopts); $response = retrieveURLasync('YK-KSM', $urls, $logger, $ans_req=1, $match='^OK', $returl=false, $timeout=10, $curlopts);
if ($response === FALSE) if ($response === false)
return false; return false;
$response = array_shift($response); $response = array_shift($response);
@ -242,7 +242,7 @@ function KSMdecryptOTP($urls, $logger, $curlopts)
function sendResp($status, $logger, $apiKey = '', $extra = null) function sendResp($status, $logger, $apiKey = '', $extra = null)
{ {
if ($logger->request !== NULL) if ($logger->request !== null)
$logger->request->set('status', $status); $logger->request->set('status', $status);
$a['status'] = $status; $a['status'] = $status;
@ -272,7 +272,7 @@ function sendResp($status, $logger, $apiKey = '', $extra = null)
$logger->log(LOG_INFO, "Response: " . $str . " (at " . gmdate("c") . " " . microtime() . ")"); $logger->log(LOG_INFO, "Response: " . $str . " (at " . gmdate("c") . " " . microtime() . ")");
if ($logger->request !== NULL) if ($logger->request !== null)
$logger->request->write(); $logger->request->write();
echo $str; echo $str;
@ -280,7 +280,7 @@ function sendResp($status, $logger, $apiKey = '', $extra = null)
} }
// backport from PHP 5.6 // backport from PHP 5.6
if (function_exists('hash_equals') === FALSE) if (function_exists('hash_equals') === false)
{ {
function hash_equals($a, $b) function hash_equals($a, $b)
{ {
@ -309,27 +309,27 @@ function total_time ($url)
$opts = array( $opts = array(
CURLOPT_URL => $url, CURLOPT_URL => $url,
CURLOPT_TIMEOUT => 3, CURLOPT_TIMEOUT => 3,
CURLOPT_FORBID_REUSE => TRUE, CURLOPT_FORBID_REUSE => true,
CURLOPT_FRESH_CONNECT => TRUE, CURLOPT_FRESH_CONNECT => true,
CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERAGENT => 'ykval-munin-vallatency/1.0', CURLOPT_USERAGENT => 'ykval-munin-vallatency/1.0',
); );
if (($ch = curl_init()) === FALSE) if (($ch = curl_init()) === false)
return false; return false;
if (curl_setopt_array($ch, $opts) === FALSE) if (curl_setopt_array($ch, $opts) === false)
return false; return false;
// we don't care about the actual response // we don't care about the actual response
if (curl_exec($ch) === FALSE) if (curl_exec($ch) === false)
return false; return false;
$total_time = curl_getinfo($ch, CURLINFO_TOTAL_TIME); $total_time = curl_getinfo($ch, CURLINFO_TOTAL_TIME);
curl_close($ch); curl_close($ch);
if (is_float($total_time) === FALSE) if (is_float($total_time) === false)
return false; return false;
return $total_time; return $total_time;
@ -355,7 +355,7 @@ function endpoints ($urls)
$internal = substr(sha1($url), 0, 20); $internal = substr(sha1($url), 0, 20);
// actual label name shown for graph values // actual label name shown for graph values
if (($label = hostport($url)) === FALSE) if (($label = hostport($url)) === false)
{ {
return false; return false;
} }
@ -387,20 +387,20 @@ function endpoints ($urls)
*/ */
function hostport ($url) function hostport ($url)
{ {
if (($url = parse_url($url)) === FALSE) if (($url = parse_url($url)) === false)
return false; return false;
if (array_key_exists('host', $url) === FALSE || $url['host'] === NULL) if (array_key_exists('host', $url) === false || $url['host'] === null)
return false; return false;
if (array_key_exists('port', $url) === TRUE && $url['port'] !== NULL) if (array_key_exists('port', $url) === true && $url['port'] !== null)
return $url['host'].':'.$url['port']; return $url['host'].':'.$url['port'];
if (array_key_exists('scheme', $url) === TRUE if (array_key_exists('scheme', $url) === true
&& strtolower($url['scheme']) === 'http') && strtolower($url['scheme']) === 'http')
return $url['host'].':80'; return $url['host'].':80';
if (array_key_exists('scheme', $url) === TRUE if (array_key_exists('scheme', $url) === true
&& strtolower($url['scheme']) === 'https') && strtolower($url['scheme']) === 'https')
return $url['host'].':443'; return $url['host'].':443';

View File

@ -72,7 +72,7 @@ class DbImpl extends Db
if (!$this->dbh) { if (!$this->dbh) {
$error = oci_error(); $error = oci_error();
$this->myLog->log(LOG_CRIT, "Database connection error: " . $error["message"]); $this->myLog->log(LOG_CRIT, "Database connection error: " . $error["message"]);
$this->dbh=Null; $this->dbh=null;
return false; return false;
} }
return true; return true;
@ -88,7 +88,7 @@ class DbImpl extends Db
$result = oci_parse($this->dbh, $query); $result = oci_parse($this->dbh, $query);
if(!oci_execute($result)) { if(!oci_execute($result)) {
$this->myLog->log(LOG_INFO, 'Database query error: ' . preg_replace('/\n/',' ',print_r(oci_error($result), true))); $this->myLog->log(LOG_INFO, 'Database query error: ' . preg_replace('/\n/',' ',print_r(oci_error($result), true)));
$this->dbh = Null; $this->dbh = null;
return false; return false;
} }
$this->result = $result; $this->result = $result;

View File

@ -71,7 +71,7 @@ class DbImpl extends Db
$this->dbh = new PDO($this->db_dsn, $this->db_username, $this->db_password, $this->db_options); $this->dbh = new PDO($this->db_dsn, $this->db_username, $this->db_password, $this->db_options);
} catch (PDOException $e) { } catch (PDOException $e) {
$this->myLog->log(LOG_CRIT, "Database connection error: " . $e->getMessage()); $this->myLog->log(LOG_CRIT, "Database connection error: " . $e->getMessage());
$this->dbh=Null; $this->dbh=null;
return false; return false;
} }
return true; return true;
@ -88,7 +88,7 @@ class DbImpl extends Db
$this->result = $this->dbh->query($query); $this->result = $this->dbh->query($query);
} catch (PDOException $e) { } catch (PDOException $e) {
$this->myLog->log(LOG_INFO, 'Database query error: ' . preg_replace('/\n/',' ',print_r($this->dbh->errorInfo(), true))); $this->myLog->log(LOG_INFO, 'Database query error: ' . preg_replace('/\n/',' ',print_r($this->dbh->errorInfo(), true)));
$this->dbh = Null; $this->dbh = null;
return false; return false;
} }
if ($returnresult) return $this->result; if ($returnresult) return $this->result;
@ -137,33 +137,33 @@ class DbImpl extends Db
* *
* @return mixed Array with values from Db row or 2d-array with multiple rows * @return mixed Array with values from Db row or 2d-array with multiple rows
*/ */
public function findByMultiple($table, $where, $nr=NULL, $rev=NULL, $distinct=NULL) public function findByMultiple($table, $where, $nr=null, $rev=null, $distinct=null)
{ {
$value = ''; $value = '';
$match = NULL; $match = null;
$query = 'SELECT'; $query = 'SELECT';
if ($distinct != NULL) if ($distinct != null)
$query.= " DISTINCT " . $distinct; $query.= " DISTINCT " . $distinct;
else else
$query.= " *"; $query.= " *";
$query.= " FROM " . $table; $query.= " FROM " . $table;
if ($where != NULL) if ($where != null)
{ {
foreach ($where as $key => $value) foreach ($where as $key => $value)
{ {
if ($key != NULL) if ($key != null)
{ {
if ($value != NULL) if ($value != null)
$match .= " ". $key . " = '" . $value . "' and"; $match .= " ". $key . " = '" . $value . "' and";
else else
$match .= " ". $key . " is NULL and"; $match .= " ". $key . " is NULL and";
} }
} }
if ($match != NULL) if ($match != null)
$query .= " WHERE" . $match; $query .= " WHERE" . $match;
$query = rtrim($query, "and"); $query = rtrim($query, "and");
@ -173,7 +173,7 @@ class DbImpl extends Db
if ($rev == 1) if ($rev == 1)
$query.= " ORDER BY id DESC"; $query.= " ORDER BY id DESC";
if ($nr != NULL) if ($nr != null)
$query.= " LIMIT " . $nr; $query.= " LIMIT " . $nr;
$result = $this->query($query, true); $result = $this->query($query, true);

View File

@ -93,7 +93,7 @@ abstract class Db
*/ */
public function disconnect() public function disconnect()
{ {
$this->dbh=NULL; $this->dbh=null;
} }
/** /**
@ -104,8 +104,8 @@ abstract class Db
*/ */
public function isConnected() public function isConnected()
{ {
if ($this->dbh!=NULL) return True; if ($this->dbh!=null) return true;
else return False; else return false;
} }
/** /**

View File

@ -31,27 +31,27 @@ require_once 'ykval-common.php';
class LogVerify class LogVerify
{ {
public $format = NULL; public $format = null;
private $fields = array( private $fields = array(
'time_start' => NULL, 'time_start' => null,
'time_end' => NULL, 'time_end' => null,
'time_taken' => NULL, 'time_taken' => null,
'ip' => NULL, 'ip' => null,
'client' => NULL, 'client' => null,
'public_id' => NULL, 'public_id' => null,
'otp' => NULL, 'otp' => null,
'status' => NULL, 'status' => null,
'nonce' => NULL, 'nonce' => null,
'signed' => NULL, 'signed' => null,
'counter' => NULL, 'counter' => null,
'low' => NULL, 'low' => null,
'high' => NULL, 'high' => null,
'use' => NULL, 'use' => null,
'tls' => NULL, 'tls' => null,
'protocol' => NULL, 'protocol' => null,
'sl' => NULL, 'sl' => null,
'timeout' => NULL, 'timeout' => null,
); );
/** /**
@ -67,7 +67,7 @@ class LogVerify
if ($name === 'time_end' || $name === 'time_taken') if ($name === 'time_end' || $name === 'time_taken')
return false; return false;
if (array_key_exists($name, $this->fields) === FALSE) if (array_key_exists($name, $this->fields) === false)
return false; return false;
$this->fields[$name] = $value; $this->fields[$name] = $value;
@ -81,7 +81,7 @@ class LogVerify
*/ */
public function write() public function write()
{ {
if ($this->format === NULL) if ($this->format === null)
return false; return false;
$values = array(); $values = array();
@ -127,25 +127,25 @@ class LogVerify
if (preg_match('/^[0-9]+$/', $a['client']) !== 1) if (preg_match('/^[0-9]+$/', $a['client']) !== 1)
$a['client'] = '-'; $a['client'] = '-';
if (filter_var($a['ip'], FILTER_VALIDATE_IP) === FALSE) if (filter_var($a['ip'], FILTER_VALIDATE_IP) === false)
$a['ip'] = '-'; $a['ip'] = '-';
if (is_int($a['counter']) === FALSE) if (is_int($a['counter']) === false)
$a['counter'] = '-'; $a['counter'] = '-';
if (is_int($a['low']) === FALSE) if (is_int($a['low']) === false)
$a['low'] = '-'; $a['low'] = '-';
if (is_int($a['high']) === FALSE) if (is_int($a['high']) === false)
$a['high'] = '-'; $a['high'] = '-';
if (is_int($a['use']) === FALSE) if (is_int($a['use']) === false)
$a['use'] = '-'; $a['use'] = '-';
if (preg_match('/^[a-zA-Z0-9]{16,40}$/', $a['nonce']) !== 1) if (preg_match('/^[a-zA-Z0-9]{16,40}$/', $a['nonce']) !== 1)
$a['nonce'] = '-'; $a['nonce'] = '-';
if (is_float($a['protocol']) === TRUE) if (is_float($a['protocol']) === true)
$a['protocol'] = sprintf('%.1f', $a['protocol']); $a['protocol'] = sprintf('%.1f', $a['protocol']);
else else
$a['protocol'] = '-'; $a['protocol'] = '-';

View File

@ -30,7 +30,7 @@
class Log class Log
{ {
// request logger object // request logger object
public $request = NULL; public $request = null;
private $log_levels = array( private $log_levels = array(
LOG_EMERG => 'LOG_EMERG', LOG_EMERG => 'LOG_EMERG',
@ -57,7 +57,7 @@ class Log
$this->fields[$name] = $value; $this->fields[$name] = $value;
} }
public function log ($priority, $message, $extra = NULL) public function log ($priority, $message, $extra = null)
{ {
$prefix = ''; $prefix = '';
foreach ($this->fields as $val) foreach ($this->fields as $val)

View File

@ -41,7 +41,7 @@ require_once 'ykval-common.php';
# otp and client ID should be moved to a munin environment variable # otp and client ID should be moved to a munin environment variable
$urls = otp2ksmurls('ccccccccfnkjtvvijktfrvvginedlbvudjhjnggndtck', 16); $urls = otp2ksmurls('ccccccccfnkjtvvijktfrvvginedlbvudjhjnggndtck', 16);
if (($endpoints = endpoints($urls)) === FALSE) if (($endpoints = endpoints($urls)) === false)
{ {
echo "Cannot parse URLs from ksm url list\n"; echo "Cannot parse URLs from ksm url list\n";
exit(1); exit(1);
@ -81,7 +81,7 @@ foreach ($endpoints as $endpoint)
{ {
list ($internal, $label, $url) = $endpoint; list ($internal, $label, $url) = $endpoint;
if (($total_time = total_time($url)) === FALSE) if (($total_time = total_time($url)) === false)
$total_time = 'error'; $total_time = 'error';
echo "${internal}_avgwait.value ${total_time}\n"; echo "${internal}_avgwait.value ${total_time}\n";

View File

@ -53,7 +53,7 @@ if ($argc == 2 && strcmp($argv[1], 'autoconf') == 0)
exit(0); exit(0);
} }
if (($endpoints = endpoints($urls)) === FALSE) if (($endpoints = endpoints($urls)) === false)
{ {
echo "Cannot parse URLs from sync pool list\n"; echo "Cannot parse URLs from sync pool list\n";
exit(1); exit(1);

View File

@ -52,7 +52,7 @@ if ($argc == 2 && strcmp($argv[1], 'autoconf') == 0)
exit(0); exit(0);
} }
if (($endpoints = endpoints($urls)) === FALSE) if (($endpoints = endpoints($urls)) === false)
{ {
echo "Cannot parse URLs from sync pool list\n"; echo "Cannot parse URLs from sync pool list\n";
exit(1); exit(1);
@ -86,7 +86,7 @@ foreach ($endpoints as $endpoint)
{ {
list ($internal, $label, $url) = $endpoint; list ($internal, $label, $url) = $endpoint;
if (($total_time = total_time($url)) === FALSE) if (($total_time = total_time($url)) === false)
$total_time = 'error'; $total_time = 'error';
echo "${internal}_avgwait.value ${total_time}\n"; echo "${internal}_avgwait.value ${total_time}\n";

View File

@ -81,7 +81,7 @@ function get_count($db, $table, $conditions)
return $r['count']; return $r['count'];
} }
return Null; return null;
} }
if ($count = get_count($db, 'yubikeys', 'active=true')) if ($count = get_count($db, 'yubikeys', 'active=true'))

View File

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

View File

@ -47,7 +47,7 @@ if (empty($_SERVER['QUERY_STRING']))
} }
// verify request sent by whitelisted address // verify request sent by whitelisted address
if (in_array($ipaddr, $allowed, TRUE) === FALSE) if (in_array($ipaddr, $allowed, true) === false)
{ {
$myLog->log(LOG_NOTICE, "Operation not allowed from IP $ipaddr"); $myLog->log(LOG_NOTICE, "Operation not allowed from IP $ipaddr");
$myLog->log(LOG_DEBUG, "Remote IP $ipaddr not listed in allowed sync pool : " . implode(', ', $allowed)); $myLog->log(LOG_DEBUG, "Remote IP $ipaddr not listed in allowed sync pool : " . implode(', ', $allowed));
@ -56,23 +56,23 @@ if (in_array($ipaddr, $allowed, TRUE) === FALSE)
// define requirements on protocol // define requirements on protocol
$syncParams = array( $syncParams = array(
'modified' => NULL, 'modified' => null,
'otp' => NULL, 'otp' => null,
'nonce' => NULL, 'nonce' => null,
'yk_publicname' => NULL, 'yk_publicname' => null,
'yk_counter' => NULL, 'yk_counter' => null,
'yk_use' => NULL, 'yk_use' => null,
'yk_high' => NULL, 'yk_high' => null,
'yk_low' => NULL 'yk_low' => null
); );
// extract values from HTTP request // extract values from HTTP request
$tmp_log = 'Received '; $tmp_log = 'Received ';
foreach ($syncParams as $param => $value) foreach ($syncParams as $param => $value)
{ {
$value = getHttpVal($param, NULL, $_GET); $value = getHttpVal($param, null, $_GET);
if ($value == NULL) if ($value == null)
{ {
$myLog->log(LOG_NOTICE, "Received request with parameter[s] ($param) missing value"); $myLog->log(LOG_NOTICE, "Received request with parameter[s] ($param) missing value");
sendResp(S_MISSING_PARAMETER, $myLog); sendResp(S_MISSING_PARAMETER, $myLog);
@ -114,7 +114,7 @@ foreach (array('modified','yk_counter', 'yk_use', 'yk_high', 'yk_low') as $param
// get local counter data // get local counter data
$yk_publicname = $syncParams['yk_publicname']; $yk_publicname = $syncParams['yk_publicname'];
if (($localParams = $sync->getLocalParams($yk_publicname)) === FALSE) if (($localParams = $sync->getLocalParams($yk_publicname)) === false)
{ {
$myLog->log(LOG_NOTICE, "Invalid Yubikey $yk_publicname"); $myLog->log(LOG_NOTICE, "Invalid Yubikey $yk_publicname");
sendResp(S_BACKEND_ERROR, $myLog); sendResp(S_BACKEND_ERROR, $myLog);

View File

@ -150,7 +150,7 @@ class SyncLib
return $result; return $result;
} }
public function log($priority, $msg, $params=NULL) public function log($priority, $msg, $params=null)
{ {
if ($params) if ($params)
$msg .= ' modified=' . $params['modified'] . $msg .= ' modified=' . $params['modified'] .
@ -466,9 +466,9 @@ class SyncLib
} }
// send out requests // send out requests
$ans_arr = retrieveURLasync('YK-VAL sync', $urls, $this->myLog, $ans_req, $match='status=OK', $returl=True, $timeout, $this->curlopts); $ans_arr = retrieveURLasync('YK-VAL sync', $urls, $this->myLog, $ans_req, $match='status=OK', $returl=true, $timeout, $this->curlopts);
if ($ans_arr === FALSE) if ($ans_arr === false)
{ {
$this->log(LOG_WARNING, 'No responses from validation server pool'); $this->log(LOG_WARNING, 'No responses from validation server pool');
$ans_arr = array(); $ans_arr = array();
@ -542,7 +542,7 @@ class SyncLib
* NULL queued_time for remaining entries in queue, to allow * NULL queued_time for remaining entries in queue, to allow
* daemon to take care of them as soon as possible. * daemon to take care of them as soon as possible.
*/ */
$this->db->updateBy('queue', 'server_nonce', $this->server_nonce, array('queued'=>NULL)); $this->db->updateBy('queue', 'server_nonce', $this->server_nonce, array('queued'=>null));
/** /**
* Return true if valid answers equals required answers. * Return true if valid answers equals required answers.

View File

@ -38,8 +38,8 @@ header('content-type: text/plain');
$ipaddr = $_SERVER['REMOTE_ADDR']; $ipaddr = $_SERVER['REMOTE_ADDR'];
$https = (array_key_exists('HTTPS', $_SERVER) === TRUE $https = (array_key_exists('HTTPS', $_SERVER) === true
&& strtolower($_SERVER['HTTPS']) !== 'off' ? TRUE : FALSE); && strtolower($_SERVER['HTTPS']) !== 'off' ? true : false);
$myLog = new Log('ykval-verify'); $myLog = new Log('ykval-verify');
$myLog->addField('ip', $ipaddr); $myLog->addField('ip', $ipaddr);
@ -255,7 +255,7 @@ if (! $sync->isConnected())
sendResp(S_BACKEND_ERROR, $myLog); sendResp(S_BACKEND_ERROR, $myLog);
} }
if (($cd = $sync->getClientData($client)) === FALSE) if (($cd = $sync->getClientData($client)) === false)
{ {
$myLog->log(LOG_NOTICE, "Invalid client id $client"); $myLog->log(LOG_NOTICE, "Invalid client id $client");
sendResp(S_NO_SUCH_CLIENT, $myLog); sendResp(S_NO_SUCH_CLIENT, $myLog);
@ -277,7 +277,7 @@ if ($h != '')
$hmac = sign($request, $apiKey, $myLog); $hmac = sign($request, $apiKey, $myLog);
if (hash_equals($hmac, $h) === FALSE) if (hash_equals($hmac, $h) === false)
{ {
$myLog->log(LOG_DEBUG, "client hmac=$h, server hmac=$hmac"); $myLog->log(LOG_DEBUG, "client hmac=$h, server hmac=$hmac");
sendResp(S_BAD_SIGNATURE, $myLog, $apiKey); sendResp(S_BAD_SIGNATURE, $myLog, $apiKey);
@ -308,7 +308,7 @@ if (array_key_exists('__YKVAL_KSM_CURL_OPTS__', $baseParams))
{ {
$curlopts = $baseParams['__YKVAL_KSM_CURL_OPTS__']; $curlopts = $baseParams['__YKVAL_KSM_CURL_OPTS__'];
} }
if (($otpinfo = KSMdecryptOTP($urls, $myLog, $curlopts)) === FALSE) if (($otpinfo = KSMdecryptOTP($urls, $myLog, $curlopts)) === false)
{ {
/** /**
* FIXME * FIXME
@ -327,7 +327,7 @@ $myLog->log(LOG_DEBUG, 'Decrypted OTP:', $otpinfo);
// get Yubikey from DB // get Yubikey from DB
$public_id = substr($otp, 0, strlen ($otp) - TOKEN_LEN); $public_id = substr($otp, 0, strlen ($otp) - TOKEN_LEN);
$myLog->request->set('public_id', $public_id); $myLog->request->set('public_id', $public_id);
if (($localParams = $sync->getLocalParams($public_id)) === FALSE) if (($localParams = $sync->getLocalParams($public_id)) === false)
{ {
$myLog->log(LOG_NOTICE, "Invalid Yubikey $public_id"); $myLog->log(LOG_NOTICE, "Invalid Yubikey $public_id");
sendResp(S_BACKEND_ERROR, $myLog, $apiKey); sendResp(S_BACKEND_ERROR, $myLog, $apiKey);
@ -414,7 +414,7 @@ $myLog->log(LOG_INFO, '', array(
'timeout' => $timeout, 'timeout' => $timeout,
)); ));
if ($syncres == False) if ($syncres == false)
{ {
/* sync returned false, indicating that /* sync returned false, indicating that
either at least 1 answer marked OTP as invalid or either at least 1 answer marked OTP as invalid or