1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-01-31 16:52:20 +01:00
This commit is contained in:
Olov Danielson 2009-12-07 16:10:07 +00:00
parent 72ecd16581
commit 3aa91fa557
2 changed files with 14 additions and 7 deletions

View File

@ -11,7 +11,7 @@ $baseParams['__YKVAL_SYNC_POOL__'] = "http://api2.yubico.com/wsapi/sync;http://a
$baseParams['__YKVAL_SYNC_INTERVAL__'] = 60;
$baseParams['__YKVAL_SYNC_MAX_SIMUL__'] = 50;
$baseParams['__YKVAL_SYNC_TIMEOUT__'] = 30;
$baseParams['__YKVAL_SYNC_OLD_LIMIT_'] = 1;
$baseParams['__YKVAL_SYNC_OLD_LIMIT__'] = 1;
# For the get-api-key service.
$baseParams['__YKGAK_DB_HOST__'] = $baseParams['__YKVAL_DB_HOST__'];

View File

@ -42,7 +42,7 @@ class SyncLib
function getLast()
{
$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']),
'otp'=>$res['otp'],
'server'=>$res['server'],
@ -67,14 +67,21 @@ class SyncLib
',local_counter=' . $localParams['yk_counter'] .
'&local_use=' . $localParams['yk_use'];
}
public function otpParamsFromInfoString($info) {
$out=explode(",", $info);
parse_str($out[0], $params);
return $params;
}
public function otpPartFromInfoString($info) {
$out=explode(",", $info);
return $out[0];
}
public function localPartFromInfoString($info)
public function localParamsFromInfoString($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)
{
@ -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));
}
public function reSync($older_than)
public function reSync($older_than=10)
{
$urls=array();
# TODO: move statement to DB class, this looks grotesque
@ -256,8 +263,8 @@ class SyncLib
foreach($entries as $entry) {
/* Warnings */
parse_str($this->localPartFromInfoString($entry['info']), $localParams);
parse_str($this->otpPartFromInfoString($entry['info']), $otpParams);
$localParams=$this->localParamsFromInfoString($entry['info']);
$otpParams=$this->otpParamsFromInfoString($entry['info']);
/* Check for warnings