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

More minor fixes.

This commit is contained in:
Jean Paul Galea 2015-07-21 20:26:37 +00:00
parent 116d992da2
commit 1ca175ef2e

View File

@ -35,6 +35,7 @@ header('content-type: text/plain');
$myLog = new Log('ykval-verify'); $myLog = new Log('ykval-verify');
$myLog->addField('ip', $_SERVER['REMOTE_ADDR']); $myLog->addField('ip', $_SERVER['REMOTE_ADDR']);
$query_string = ''; $query_string = '';
if ($_POST) if ($_POST)
{ {
@ -57,11 +58,11 @@ $myLog->log(LOG_INFO, $query_string .
/* 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; $protocol_version = $out[1] + $out[2] * 0.1;
} }
else else
{ {
$protocol_version=1.0; $protocol_version = 1.0;
} }
$myLog->log(LOG_DEBUG, "found protocol version $protocol_version"); $myLog->log(LOG_DEBUG, "found protocol version $protocol_version");
@ -77,7 +78,7 @@ $otp = strtolower($otp);
if (preg_match('/^[jxe.uidchtnbpygk]+$/', $otp)) if (preg_match('/^[jxe.uidchtnbpygk]+$/', $otp))
{ {
$new_otp = strtr($otp, 'jxe.uidchtnbpygk', 'cbdefghijklnrtuv'); $new_otp = strtr($otp, 'jxe.uidchtnbpygk', 'cbdefghijklnrtuv');
$myLog->log(LOG_INFO, 'Dvorak OTP converting ' . $otp . ' to ' . $new_otp); $myLog->log(LOG_INFO, "Dvorak OTP converting $otp to $new_otp");
$otp = $new_otp; $otp = $new_otp;
} }
@ -87,9 +88,10 @@ $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;
} }
@ -103,7 +105,7 @@ if ($protocol_version >= 2.0)
$nonce = getHttpVal('nonce', ''); $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)
@ -219,8 +221,10 @@ if (($cd = $sync->getClientData($client)) === FALSE)
} }
$myLog->log(LOG_DEBUG, 'Client data:', $cd); $myLog->log(LOG_DEBUG, 'Client data:', $cd);
//// Check client signature
// /**
* Check client signature
*/
$apiKey = base64_decode($cd['secret']); $apiKey = base64_decode($cd['secret']);
if ($h != '') if ($h != '')
@ -443,7 +447,10 @@ if ($sessionCounter == $seenSessionCounter && $sessionUse > $seenSessionUse)
} }
} }
/* Fill up with more respone parameters */ /**
* Fill up with more response parameters
*/
if ($protocol_version >= 2.0) if ($protocol_version >= 2.0)
{ {
$extra['sl'] = $sl_success_rate; $extra['sl'] = $sl_success_rate;