mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-02-20 12:54:23 +01:00
parent
33076b2670
commit
24b948e7d4
@ -208,28 +208,17 @@ function retrieveURLasync ($ident, $urls, $logger, $ans_req=1, $match="^OK", $re
|
|||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
function retrieveURLsimple ($url, $match="^OK") {
|
|
||||||
foreach (file($url) as $line) {
|
|
||||||
if (preg_match("/".$match."/", $line)) {
|
|
||||||
return $line;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// $otp: A yubikey OTP
|
// $otp: A yubikey OTP
|
||||||
function KSMdecryptOTP($urls, $logger) {
|
function KSMdecryptOTP($urls, $logger) {
|
||||||
$ret = array();
|
$ret = array();
|
||||||
if (!is_array($urls)) {
|
if (!is_array($urls)) {
|
||||||
$response = retrieveURLsimple ($urls);
|
$urls = array($urls);
|
||||||
} elseif (count($urls) == 1) {
|
}
|
||||||
$response = retrieveURLsimple ($urls[0]);
|
|
||||||
} else {
|
|
||||||
$response = retrieveURLasync ("YK-KSM", $urls, $logger, $ans_req=1, $match="^OK", $returl=False, $timeout=10);
|
$response = retrieveURLasync ("YK-KSM", $urls, $logger, $ans_req=1, $match="^OK", $returl=False, $timeout=10);
|
||||||
if (is_array($response)) {
|
if (is_array($response)) {
|
||||||
$response = $response[0];
|
$response = $response[0];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if ($response) {
|
if ($response) {
|
||||||
$logger->log(LOG_DEBUG, log_format("YK-KSM response: ", $response));
|
$logger->log(LOG_DEBUG, log_format("YK-KSM response: ", $response));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user