Do not pass vouchers shorter than 5 characters to voucher application, they

are too short to be a valid voucher.

Discussed with:		Jim P
Issue:			#4985
This commit is contained in:
Luiz Otavio O Souza 2015-09-22 07:57:05 -05:00
parent c3b1d3ff57
commit 4ccf7dd97a

View File

@ -249,8 +249,10 @@ function voucher_expire($voucher_received) {
// Roll# and Ticket# using the external readvoucher binary
foreach ($a_vouchers_received as $voucher) {
$v = escapeshellarg($voucher);
if (strlen($voucher) < 3)
if (strlen($voucher) < 5) {
captiveportal_syslog("{$voucher} invalid: Too short!");
continue; // seems too short to be a voucher!
}
unset($output);
$_gb = exec("/usr/local/bin/voucher -c {$g['varetc_path']}/voucher_{$cpzone}.cfg -k {$g['varetc_path']}/voucher_{$cpzone}.public -- $v", $output);
@ -371,7 +373,7 @@ function voucher_auth($voucher_received, $test = 0) {
// Roll# and Ticket# using the external readvoucher binary
foreach ($a_vouchers_received as $voucher) {
$v = escapeshellarg($voucher);
if (strlen($voucher) < 3) {
if (strlen($voucher) < 5) {
$test_result[] = "{$voucher} invalid: Too short!";
captiveportal_syslog("{$voucher} invalid: Too short!");
$error++;