mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-04-09 20:53:50 +02:00
Cosmetic changes.
This commit is contained in:
parent
38c048b833
commit
2170247166
@ -53,11 +53,14 @@ $myLog->log(LOG_INFO, $query_string .
|
|||||||
(isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on" ? "HTTPS" : "HTTP"));
|
(isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on" ? "HTTPS" : "HTTP"));
|
||||||
|
|
||||||
/* Detect protocol version */
|
/* Detect protocol version */
|
||||||
if (preg_match("/\/wsapi\/([0-9]+)\.([0-9]+)\//", $_SERVER['REQUEST_URI'], $out)) {
|
if (preg_match("/\/wsapi\/([0-9]+)\.([0-9]+)\//", $_SERVER['REQUEST_URI'], $out))
|
||||||
$protocol_version=$out[1]+$out[2]*0.1;
|
{
|
||||||
} else {
|
$protocol_version=$out[1]+$out[2]*0.1;
|
||||||
$protocol_version=1.0;
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
$protocol_version=1.0;
|
||||||
|
}
|
||||||
|
|
||||||
$myLog->log(LOG_DEBUG, "found protocol version " . $protocol_version);
|
$myLog->log(LOG_DEBUG, "found protocol version " . $protocol_version);
|
||||||
|
|
||||||
@ -67,36 +70,40 @@ $h = getHttpVal('h', '');
|
|||||||
$client = getHttpVal('id', 0);
|
$client = getHttpVal('id', 0);
|
||||||
$otp = getHttpVal('otp', '');
|
$otp = getHttpVal('otp', '');
|
||||||
$otp = strtolower($otp);
|
$otp = strtolower($otp);
|
||||||
if (preg_match("/^[jxe.uidchtnbpygk]+$/", $otp)) {
|
if (preg_match("/^[jxe.uidchtnbpygk]+$/", $otp))
|
||||||
$new_otp = strtr($otp, "jxe.uidchtnbpygk", "cbdefghijklnrtuv");
|
{
|
||||||
$myLog->log(LOG_INFO, 'Dvorak OTP converting ' . $otp . ' to ' . $new_otp);
|
$new_otp = strtr($otp, "jxe.uidchtnbpygk", "cbdefghijklnrtuv");
|
||||||
$otp = $new_otp;
|
$myLog->log(LOG_INFO, 'Dvorak OTP converting ' . $otp . ' to ' . $new_otp);
|
||||||
|
$otp = $new_otp;
|
||||||
}
|
}
|
||||||
$timestamp = getHttpVal('timestamp', 0);
|
$timestamp = getHttpVal('timestamp', 0);
|
||||||
|
|
||||||
/* Construct response parameters */
|
/* Construct response parameters */
|
||||||
$extra=array();
|
$extra = array();
|
||||||
if ($protocol_version>=2.0) {
|
if ($protocol_version >= 2.0)
|
||||||
$extra['otp']=$otp;
|
{
|
||||||
|
$extra['otp']=$otp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* We have the OTP now, so let's add it to the logging */
|
/* We have the OTP now, so let's add it to the logging */
|
||||||
$myLog->addField('otp', $otp);
|
$myLog->addField('otp', $otp);
|
||||||
|
|
||||||
if ($protocol_version>=2.0) {
|
if ($protocol_version >= 2.0)
|
||||||
$sl = getHttpVal('sl', '');
|
{
|
||||||
$timeout = getHttpVal('timeout', '');
|
$sl = getHttpVal('sl', '');
|
||||||
$nonce = getHttpVal('nonce', '');
|
$timeout = getHttpVal('timeout', '');
|
||||||
|
$nonce = getHttpVal('nonce', '');
|
||||||
|
|
||||||
/* Add nonce to response parameters */
|
/* Add nonce to response parameters */
|
||||||
$extra['nonce']= $nonce;
|
$extra['nonce']= $nonce;
|
||||||
|
|
||||||
/* Nonce is required from protocol 2.0 */
|
/* Nonce is required from protocol 2.0 */
|
||||||
if(!$nonce) {
|
if (!$nonce)
|
||||||
$myLog->log(LOG_NOTICE, 'Nonce is missing and protocol version >= 2.0');
|
{
|
||||||
sendResp(S_MISSING_PARAMETER, $myLog);
|
$myLog->log(LOG_NOTICE, 'Nonce is missing and protocol version >= 2.0');
|
||||||
}
|
sendResp(S_MISSING_PARAMETER, $myLog);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -180,15 +187,17 @@ $sync = new SyncLib('ykval-verify:synclib');
|
|||||||
$sync->addField('ip', $_SERVER['REMOTE_ADDR']);
|
$sync->addField('ip', $_SERVER['REMOTE_ADDR']);
|
||||||
$sync->addField('otp', $otp);
|
$sync->addField('otp', $otp);
|
||||||
|
|
||||||
if (! $sync->isConnected()) {
|
if (! $sync->isConnected())
|
||||||
sendResp(S_BACKEND_ERROR, $myLog);
|
{
|
||||||
}
|
sendResp(S_BACKEND_ERROR, $myLog);
|
||||||
|
}
|
||||||
|
|
||||||
$cd=$sync->getClientData($client);
|
$cd = $sync->getClientData($client);
|
||||||
if(!$cd) {
|
if (!$cd)
|
||||||
$myLog->log(LOG_NOTICE, 'Invalid client id ' . $client);
|
{
|
||||||
sendResp(S_NO_SUCH_CLIENT, $myLog);
|
$myLog->log(LOG_NOTICE, 'Invalid client id ' . $client);
|
||||||
}
|
sendResp(S_NO_SUCH_CLIENT, $myLog);
|
||||||
|
}
|
||||||
$myLog->log(LOG_DEBUG,"Client data:", $cd);
|
$myLog->log(LOG_DEBUG,"Client data:", $cd);
|
||||||
|
|
||||||
//// Check client signature
|
//// Check client signature
|
||||||
|
Loading…
x
Reference in New Issue
Block a user