1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-02-12 15:54:27 +01:00

Cosmetic changes.

This commit is contained in:
Jean Paul Galea 2015-07-17 21:38:00 +02:00
parent 8edf9ba465
commit 45ea62445c

View File

@ -215,26 +215,33 @@ function retrieveURLasync ($ident, $urls, $logger, $ans_req=1, $match="^OK", $re
return $str; return $str;
} }
function KSMdecryptOTP($urls, $logger, $curlopts) { function KSMdecryptOTP($urls, $logger, $curlopts)
$ret = array(); {
if (!is_array($urls)) { $ret = array();
$urls = array($urls);
}
$response = retrieveURLasync ("YK-KSM", $urls, $logger, $ans_req=1, $match="^OK", $returl=False, $timeout=10, $curlopts); if (!is_array($urls))
if (is_array($response)) { {
$response = $response[0]; $urls = array($urls);
} }
if ($response) {
$logger->log(LOG_DEBUG, log_format("YK-KSM response: ", $response)); $response = retrieveURLasync("YK-KSM", $urls, $logger, $ans_req=1, $match="^OK", $returl=False, $timeout=10, $curlopts);
}
if (sscanf ($response, if (is_array($response))
"OK counter=%04x low=%04x high=%02x use=%02x", {
$ret["session_counter"], $ret["low"], $ret["high"], $response = $response[0];
$ret["session_use"]) != 4) { }
return false;
} if ($response)
return $ret; {
$logger->log(LOG_DEBUG, log_format("YK-KSM response: ", $response));
}
if (sscanf($response, "OK counter=%04x low=%04x high=%02x use=%02x", $ret["session_counter"], $ret["low"], $ret["high"], $ret["session_use"]) != 4)
{
return false;
}
return $ret;
} }
function sendResp($status, $logger, $apiKey = '', $extra = null) { function sendResp($status, $logger, $apiKey = '', $extra = null) {