From da24a3fe308e2a4c7d3d5450da84cbc0c8f5eb5b Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Wed, 22 Feb 2012 14:27:24 +0100 Subject: [PATCH] fix fast or secure strings as sl move transformation of strings for sync and default values for sync and timeout to before sanity checking. --- ykval-verify.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ykval-verify.php b/ykval-verify.php index 37f7988..4de4c55 100644 --- a/ykval-verify.php +++ b/ykval-verify.php @@ -74,6 +74,12 @@ 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 ($otp == '') { $myLog->log(LOG_NOTICE, 'OTP is missing'); sendResp(S_MISSING_PARAMETER); @@ -266,12 +272,6 @@ if (!$sync->queue($otpParams, $localParams)) { exit; } -/* 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__']; - $nr_servers=$sync->getNumberOfServers(); $req_answers=ceil($nr_servers*$sl/100.0); if ($req_answers>0) {