1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-02-01 01:52:18 +01:00

When there is only one KSM, use more portable code without async.

Patch from arte42.ripe in issue #7.
This commit is contained in:
Simon Josefsson 2010-05-17 13:08:48 +00:00
parent 7b18b50ee7
commit c94affd1d9
2 changed files with 19 additions and 1 deletions

3
NEWS
View File

@ -5,6 +5,9 @@
* When number of sync servers equals zero, set sync result to success.
Patch from arte42.ripe in issue #7.
* When there is only one KSM, use more portable code without async.
Patch from arte42.ripe in issue #7.
* Add files COPYING and AUTHORS.
* Version 2.4 released 2010-03-16

View File

@ -195,10 +195,25 @@ function retrieveURLasync ($urls, $ans_req=1, $match="^OK", $returl=False) {
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
function KSMdecryptOTP($urls) {
$ret = array();
$response = retrieveURLasync ($urls);
if (!is_array($urls)) {
$response = retrieveURLsimple ($urls);
} elseif (count($urls) == 1) {
$response = retrieveURLsimple ($urls[0]);
} else {
$response = retrieveURLasync ($urls);
}
if ($response) {
debug("YK-KSM response: " . $response);
}