summaryrefslogtreecommitdiffstats
path: root/etc/inc/voucher.inc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-12-14 22:27:32 +0000
committerErmal <eri@pfsense.org>2010-12-14 22:27:35 +0000
commiteaca40dffe3f8bd349163e04f4f0489978a40029 (patch)
tree6f6265b04737cb730b45c2c835ce071b4ab90dcd /etc/inc/voucher.inc
parentc1f9a4df29ba11a8759c3897e0c6db707f371808 (diff)
downloadpfsense-eaca40dffe3f8bd349163e04f4f0489978a40029.zip
pfsense-eaca40dffe3f8bd349163e04f4f0489978a40029.tar.gz
Cleanup of whitespace and use exclusive lock during reconfiguration of vouchers.
Diffstat (limited to 'etc/inc/voucher.inc')
-rw-r--r--etc/inc/voucher.inc21
1 files changed, 11 insertions, 10 deletions
diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc
index 3b8e1ac..98a5340 100644
--- a/etc/inc/voucher.inc
+++ b/etc/inc/voucher.inc
@@ -250,15 +250,15 @@ function voucher_auth($voucher_received, $test = 0) {
function voucher_configure() {
global $config, $g;
-
- /* kill any running minicron */
- killbypid("{$g['varrun_path']}/vouchercron.pid");
- if (isset($config['voucher']['enable'])) {
+ /* kill any running minicron */
+ killbypid("{$g['varrun_path']}/vouchercron.pid");
- if ($g['booting']) {
+ if (isset($config['voucher']['enable']))
+ return 0;
+
+ if ($g['booting'])
echo "Enabling voucher support... ";
- }
// start cron if we're asked to save runtime DB periodically
// to XML config if it changed
@@ -269,7 +269,8 @@ function voucher_configure() {
"/etc/rc.savevoucher");
}
- $voucherlck = lock('voucher');
+ $voucherlck = lock('voucher', LOCK_EX);
+
/* write public key used to verify vouchers */
$pubkey = base64_decode($config['voucher']['publickey']);
$fd = fopen("{$g['varetc_path']}/voucher.public", "w");
@@ -323,8 +324,8 @@ function voucher_configure() {
unlock($voucherlck);
echo "done\n";
}
- }
- return 0;
+
+ return 0;
}
/* write bitstring of used vouchers to ramdisk.
@@ -483,4 +484,4 @@ function voucher_save_db_to_config() {
return;
}
-?> \ No newline at end of file
+?>
OpenPOWER on IntegriCloud