mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-02-07 18:54:23 +01:00
.
This commit is contained in:
parent
72ecd16581
commit
3aa91fa557
@ -11,7 +11,7 @@ $baseParams['__YKVAL_SYNC_POOL__'] = "http://api2.yubico.com/wsapi/sync;http://a
|
|||||||
$baseParams['__YKVAL_SYNC_INTERVAL__'] = 60;
|
$baseParams['__YKVAL_SYNC_INTERVAL__'] = 60;
|
||||||
$baseParams['__YKVAL_SYNC_MAX_SIMUL__'] = 50;
|
$baseParams['__YKVAL_SYNC_MAX_SIMUL__'] = 50;
|
||||||
$baseParams['__YKVAL_SYNC_TIMEOUT__'] = 30;
|
$baseParams['__YKVAL_SYNC_TIMEOUT__'] = 30;
|
||||||
$baseParams['__YKVAL_SYNC_OLD_LIMIT_'] = 1;
|
$baseParams['__YKVAL_SYNC_OLD_LIMIT__'] = 1;
|
||||||
|
|
||||||
# For the get-api-key service.
|
# For the get-api-key service.
|
||||||
$baseParams['__YKGAK_DB_HOST__'] = $baseParams['__YKVAL_DB_HOST__'];
|
$baseParams['__YKGAK_DB_HOST__'] = $baseParams['__YKVAL_DB_HOST__'];
|
||||||
|
@ -42,7 +42,7 @@ class SyncLib
|
|||||||
function getLast()
|
function getLast()
|
||||||
{
|
{
|
||||||
$res=$this->db->last('queue', 1);
|
$res=$this->db->last('queue', 1);
|
||||||
parse_str($this->otpPartFromInfoString($res['info']), $info);
|
$info=$this->otpParamsFromInfoString($res['info']);
|
||||||
return array('modified'=>$this->DbTimeToUnix($res['modified_time']),
|
return array('modified'=>$this->DbTimeToUnix($res['modified_time']),
|
||||||
'otp'=>$res['otp'],
|
'otp'=>$res['otp'],
|
||||||
'server'=>$res['server'],
|
'server'=>$res['server'],
|
||||||
@ -67,14 +67,21 @@ class SyncLib
|
|||||||
',local_counter=' . $localParams['yk_counter'] .
|
',local_counter=' . $localParams['yk_counter'] .
|
||||||
'&local_use=' . $localParams['yk_use'];
|
'&local_use=' . $localParams['yk_use'];
|
||||||
}
|
}
|
||||||
|
public function otpParamsFromInfoString($info) {
|
||||||
|
$out=explode(",", $info);
|
||||||
|
parse_str($out[0], $params);
|
||||||
|
return $params;
|
||||||
|
}
|
||||||
public function otpPartFromInfoString($info) {
|
public function otpPartFromInfoString($info) {
|
||||||
$out=explode(",", $info);
|
$out=explode(",", $info);
|
||||||
return $out[0];
|
return $out[0];
|
||||||
}
|
}
|
||||||
public function localPartFromInfoString($info)
|
public function localParamsFromInfoString($info)
|
||||||
{
|
{
|
||||||
$out=explode(",", $info);
|
$out=explode(",", $info);
|
||||||
return $out[1];
|
parse_str($out[1], $params);
|
||||||
|
return array('yk_counter'=>$params['local_counter'],
|
||||||
|
'yk_use'=>$params['local_use']);
|
||||||
}
|
}
|
||||||
public function queue($otpParams, $localParams)
|
public function queue($otpParams, $localParams)
|
||||||
{
|
{
|
||||||
@ -197,7 +204,7 @@ class SyncLib
|
|||||||
$this->db->deleteByMultiple('queue', array("modified_time"=>$this->UnixToDbTime($this->otpParams['modified']), "random_key"=>$this->random_key, 'server'=>$server));
|
$this->db->deleteByMultiple('queue', array("modified_time"=>$this->UnixToDbTime($this->otpParams['modified']), "random_key"=>$this->random_key, 'server'=>$server));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reSync($older_than)
|
public function reSync($older_than=10)
|
||||||
{
|
{
|
||||||
$urls=array();
|
$urls=array();
|
||||||
# TODO: move statement to DB class, this looks grotesque
|
# TODO: move statement to DB class, this looks grotesque
|
||||||
@ -256,8 +263,8 @@ class SyncLib
|
|||||||
foreach($entries as $entry) {
|
foreach($entries as $entry) {
|
||||||
/* Warnings */
|
/* Warnings */
|
||||||
|
|
||||||
parse_str($this->localPartFromInfoString($entry['info']), $localParams);
|
$localParams=$this->localParamsFromInfoString($entry['info']);
|
||||||
parse_str($this->otpPartFromInfoString($entry['info']), $otpParams);
|
$otpParams=$this->otpParamsFromInfoString($entry['info']);
|
||||||
|
|
||||||
/* Check for warnings
|
/* Check for warnings
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user