summaryrefslogtreecommitdiffstats
path: root/etc/inc/voucher.inc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2010-12-22 10:29:52 -0500
committerScott Ullrich <sullrich@pfsense.org>2010-12-22 10:29:59 -0500
commit4ac251b8634a52fb5879a37af123e824b6fc8a24 (patch)
tree67cc18436d0bfe5064fac051cb8f0cc591498f0a /etc/inc/voucher.inc
parent6ac988f1e53a4352fe8452c2e42a0b5bee5bbee7 (diff)
downloadpfsense-4ac251b8634a52fb5879a37af123e824b6fc8a24.zip
pfsense-4ac251b8634a52fb5879a37af123e824b6fc8a24.tar.gz
Log voucher errors. Fix whitespace. Remove trailing c/r
Diffstat (limited to 'etc/inc/voucher.inc')
-rw-r--r--etc/inc/voucher.inc17
1 files changed, 10 insertions, 7 deletions
diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc
index 5c1d132..ab6fac1 100644
--- a/etc/inc/voucher.inc
+++ b/etc/inc/voucher.inc
@@ -166,6 +166,7 @@ function voucher_auth($voucher_received, $test = 0) {
$mask = 1 << ($nr % 8);
if (ord($bitstring[$roll][$pos]) & $mask) {
$test_result[] = "$voucher ($roll/$nr) already used and expired";
+ log_error("$voucher ($roll/$nr) already used and expired");
$total_minutes = -1; // voucher expired
$error++;
} else {
@@ -177,10 +178,12 @@ function voucher_auth($voucher_received, $test = 0) {
}
} else {
$test_result[] = "$voucher ($roll/$nr): not found on any registererd Roll";
+ log_error("$voucher ($roll/$nr): not found on any registererd Roll");
}
} else {
// hmm, thats weird ... not what I expected
$test_result[] = "$voucher invalid: $result !!";
+ log_error("$voucher invalid: $result !!");
$error++;
}
}
@@ -192,7 +195,7 @@ function voucher_auth($voucher_received, $test = 0) {
} else {
$test_result[] = "Access granted for $total_minutes Minutes in total.";
}
- unlock($voucherlck);
+ unlock($voucherlck);
return $test_result;
}
@@ -201,7 +204,7 @@ function voucher_auth($voucher_received, $test = 0) {
// the user wouldn't know that he used at least one invalid voucher.
if ($error) {
- unlock($voucherlck);
+ unlock($voucherlck);
if ($total_minutes > 0) // probably not needed, but want to make sure
$total_minutes = 0; // we only report -1 (expired) or 0 (no access)
return $total_minutes; // well, at least one voucher had errors. Say NO ACCESS
@@ -274,7 +277,7 @@ function voucher_configure() {
$fd = fopen("{$g['varetc_path']}/voucher.public", "w");
if (!$fd) {
log_error("Voucher error: cannot write voucher.public\n");
- unlock($voucherlck);
+ unlock($voucherlck);
return 1;
}
fwrite($fd, $pubkey);
@@ -291,13 +294,13 @@ function voucher_configure() {
fwrite($fd, "{$config['voucher']['rollbits']},{$config['voucher']['ticketbits']},{$config['voucher']['checksumbits']},{$config['voucher']['magic']},{$config['voucher']['charset']}\n");
fclose($fd);
@chmod("{$g['varetc_path']}/voucher.cfg", 0600);
- unlock($voucherlck);
+ unlock($voucherlck);
if ($g['booting'] && is_array($config['voucher']['roll'])) {
// create active and used DB per roll on ramdisk from config
$a_roll = &$config['voucher']['roll'];
- $voucherlck = lock('voucher');
+ $voucherlck = lock('voucher');
foreach ($a_roll as $rollent) {
@@ -319,7 +322,7 @@ function voucher_configure() {
voucher_write_active_db($roll, $active_vouchers);
}
- unlock($voucherlck);
+ unlock($voucherlck);
echo "done\n";
}
@@ -470,4 +473,4 @@ function voucher_save_db_to_config() {
return;
}
-?>
+?> \ No newline at end of file
OpenPOWER on IntegriCloud