mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-02-08 03:54:20 +01:00
Set __YKVAL_SYNC_CURL_OPTS__ for resync requests.
- Ensure sync/resync requests set the same curl options. - This changes a debug message from "url is " to "YK-VAL resync adding URL: " - curlopts is now a property of SyncLib class. Removes duplication between sync/resync code.
This commit is contained in:
parent
4da7dc7895
commit
9d9875c39d
@ -36,6 +36,7 @@ class SyncLib
|
|||||||
{
|
{
|
||||||
public $syncServers = null;
|
public $syncServers = null;
|
||||||
public $dbConn = null;
|
public $dbConn = null;
|
||||||
|
public $curlopts = array();
|
||||||
|
|
||||||
function __construct($logname='ykval-synclib')
|
function __construct($logname='ykval-synclib')
|
||||||
{
|
{
|
||||||
@ -46,6 +47,9 @@ class SyncLib
|
|||||||
$this->isConnected=$this->db->connect();
|
$this->isConnected=$this->db->connect();
|
||||||
$this->server_nonce=md5(uniqid(rand()));
|
$this->server_nonce=md5(uniqid(rand()));
|
||||||
|
|
||||||
|
if (array_key_exists('__YKVAL_SYNC_CURL_OPTS__', $baseParams)) {
|
||||||
|
$this->curlopts = $baseParams['__YKVAL_SYNC_CURL_OPTS__'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addField($name, $value)
|
function addField($name, $value)
|
||||||
@ -326,12 +330,9 @@ class SyncLib
|
|||||||
"&" . $this->otpPartFromInfoString($entry['info']);
|
"&" . $this->otpPartFromInfoString($entry['info']);
|
||||||
|
|
||||||
/* Send out sync request */
|
/* Send out sync request */
|
||||||
$this->log(LOG_DEBUG, 'url is ' . $url);
|
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_settings($this, "YK-VAL resync", $ch, $url, $timeout, $this->curlopts);
|
||||||
curl_setopt($ch, CURLOPT_USERAGENT, "YK-VAL");
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
||||||
curl_setopt($ch, CURLOPT_FAILONERROR, true);
|
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
|
||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
|
|
||||||
if ($response==False) {
|
if ($response==False) {
|
||||||
@ -430,17 +431,10 @@ class SyncLib
|
|||||||
"&" . $this->otpPartFromInfoString($row['info']);
|
"&" . $this->otpPartFromInfoString($row['info']);
|
||||||
}
|
}
|
||||||
|
|
||||||
global $baseParams;
|
|
||||||
$curlopts = array();
|
|
||||||
|
|
||||||
if (array_key_exists('__YKVAL_SYNC_CURL_OPTS__', $baseParams)) {
|
|
||||||
$curlopts = $baseParams['__YKVAL_SYNC_CURL_OPTS__'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Send out requests
|
Send out requests
|
||||||
*/
|
*/
|
||||||
$ans_arr=$this->retrieveURLasync_wrap($urls, $ans_req, $timeout, $curlopts);
|
$ans_arr=$this->retrieveURLasync_wrap($urls, $ans_req, $timeout, $this->curlopts);
|
||||||
|
|
||||||
if (!is_array($ans_arr)) {
|
if (!is_array($ans_arr)) {
|
||||||
$this->log(LOG_WARNING, 'No responses from validation server pool');
|
$this->log(LOG_WARNING, 'No responses from validation server pool');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user