1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2024-11-29 00:24:13 +01:00

Cosmetic changes.

This commit is contained in:
Jean Paul Galea 2015-07-17 23:06:21 +02:00
parent a0de5b9fd5
commit fd5391bb91

View File

@ -162,47 +162,54 @@ class SyncLib
error_log("Warning: myLog uninitialized in ykval-synclib.php. Message is " . $logMsg);
}
function getLocalParams($yk_publicname)
{
$this->log(LOG_DEBUG, "searching for yk_publicname $yk_publicname in local db");
$res = $this->db->findBy('yubikeys', 'yk_publicname', $yk_publicname, 1);
function getLocalParams($yk_publicname)
{
$this->log(LOG_DEBUG, "searching for yk_publicname $yk_publicname in local db");
if (!$res) {
$this->log(LOG_NOTICE, "Discovered new identity $yk_publicname");
$this->db->save('yubikeys', array(
'active'=>1,
'created'=>time(),
'modified'=>-1,
'yk_publicname'=>$yk_publicname,
'yk_counter'=>-1,
'yk_use'=>-1,
'yk_low'=>-1,
'yk_high'=>-1,
'nonce'=> '0000000000000000',
'notes'=>''
));
$res=$this->db->findBy('yubikeys', 'yk_publicname', $yk_publicname,1);
}
$res = $this->db->findBy('yubikeys', 'yk_publicname', $yk_publicname, 1);
if ($res) {
$localParams = array(
'modified' => $res['modified'],
'nonce' => $res['nonce'],
'active' => $res['active'],
'yk_publicname' => $yk_publicname,
'yk_counter' => $res['yk_counter'],
'yk_use' => $res['yk_use'],
'yk_high' => $res['yk_high'],
'yk_low' => $res['yk_low']
);
if (!$res)
{
$this->log(LOG_NOTICE, "Discovered new identity $yk_publicname");
$this->log(LOG_INFO, "yubikey found in db ", $localParams);
return $localParams;
} else {
$this->log(LOG_NOTICE, "params for yk_publicname $yk_publicname not found in database");
return false;
}
}
$this->db->save('yubikeys', array(
'active' => 1,
'created' => time(),
'modified' => -1,
'yk_publicname' => $yk_publicname,
'yk_counter' => -1,
'yk_use' => -1,
'yk_low' => -1,
'yk_high' => -1,
'nonce' => '0000000000000000',
'notes' => ''
));
$res = $this->db->findBy('yubikeys', 'yk_publicname', $yk_publicname, 1);
}
if ($res)
{
$localParams = array(
'modified' => $res['modified'],
'nonce' => $res['nonce'],
'active' => $res['active'],
'yk_publicname' => $yk_publicname,
'yk_counter' => $res['yk_counter'],
'yk_use' => $res['yk_use'],
'yk_high' => $res['yk_high'],
'yk_low' => $res['yk_low']
);
$this->log(LOG_INFO, "yubikey found in db ", $localParams);
return $localParams;
}
else
{
$this->log(LOG_NOTICE, "params for yk_publicname $yk_publicname not found in database");
return false;
}
}
private function parseParamsFromMultiLineString($str)
{