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

Silence PHP warnings.

This commit is contained in:
Simon Josefsson 2012-05-21 08:49:42 +02:00
parent 7c94240386
commit f2b05822ef
3 changed files with 20 additions and 10 deletions

View File

@ -26,7 +26,9 @@ if ($argc==2 && strcmp($argv[1], "config") == 0) {
}
$sync = new SyncLib('ykval-verify:synclib');
$sync->addField('ip', $_SERVER['REMOTE_ADDR']);
if (isset($_SERVER['REMOTE_ADDR'])) {
$sync->addField('ip', $_SERVER['REMOTE_ADDR']);
}
$len = $sync->getQueueLength ();
echo "queuelength.value $len\n";

View File

@ -538,7 +538,7 @@ class SyncLib
while ($info = curl_multi_info_read($mh)) {
debug ("YK-KSM multi", $info);
if ($info['result'] == CURL_OK) {
if ($info['result'] == CURLE_OK) {
$str = curl_multi_getcontent($info['handle']);
if (preg_match("/status=OK/", $str)) {
$error = curl_error ($info['handle']);

View File

@ -39,7 +39,7 @@ $timestamp = getHttpVal('timestamp', 0);
$extra=array();
if ($protocol_version>=2.0) {
$extra['otp']=$otp;
}
}
/* We have the OTP now, so let's add it to the logging */
@ -59,7 +59,7 @@ if ($protocol_version>=2.0) {
sendResp(S_MISSING_PARAMETER);
exit;
}
}
}
/* Sanity check HTTP parameters
@ -75,10 +75,18 @@ if ($protocol_version>=2.0) {
*/
/* Change default protocol "strings" to numeric values */
if (strcasecmp($sl, 'fast')==0) $sl=$baseParams['__YKVAL_SYNC_FAST_LEVEL__'];
if (strcasecmp($sl, 'secure')==0) $sl=$baseParams['__YKVAL_SYNC_SECURE_LEVEL__'];
if (!$sl) $sl=$baseParams['__YKVAL_SYNC_DEFAULT_LEVEL__'];
if (!$timeout) $timeout=$baseParams['__YKVAL_SYNC_DEFAULT_TIMEOUT__'];
if (isset($sl) && strcasecmp($sl, 'fast')==0) {
$sl=$baseParams['__YKVAL_SYNC_FAST_LEVEL__'];
}
if (isset($sl) && strcasecmp($sl, 'secure')==0) {
$sl=$baseParams['__YKVAL_SYNC_SECURE_LEVEL__'];
}
if (!isset($sl)) {
$sl=$baseParams['__YKVAL_SYNC_DEFAULT_LEVEL__'];
}
if (!isset($timeout)) {
$timeout=$baseParams['__YKVAL_SYNC_DEFAULT_TIMEOUT__'];
}
if ($otp == '') {
$myLog->log(LOG_NOTICE, 'OTP is missing');
@ -110,13 +118,13 @@ if ($timeout && preg_match("/^[0-9]+$/", $timeout)==0) {
exit;
}
if ($nonce && preg_match("/^[A-Za-z0-9]+$/", $nonce)==0) {
if (isset($nonce) && preg_match("/^[A-Za-z0-9]+$/", $nonce)==0) {
$myLog->log(LOG_NOTICE, 'NONCE is provided but not correct');
sendResp(S_MISSING_PARAMETER);
exit;
}
if ($nonce && (strlen($nonce) < 16 || strlen($nonce) > 40)) {
if (isset($nonce) && (strlen($nonce) < 16 || strlen($nonce) > 40)) {
$myLog->log(LOG_NOTICE, 'Nonce too short or too long');
sendResp(S_MISSING_PARAMETER);
exit;