summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2017-01-11 08:53:24 -0500
committerjim-p <jimp@pfsense.org>2017-01-11 08:54:08 -0500
commit6ca5c3ca6f257db8648e4fafe1443158c915ff8a (patch)
tree588f63258f3f05e404417c5ea0d64506a569eaf8
parent00a9abb934149d919693e63a9e78aea6748e1447 (diff)
downloadpfsense-6ca5c3ca6f257db8648e4fafe1443158c915ff8a.zip
pfsense-6ca5c3ca6f257db8648e4fafe1443158c915ff8a.tar.gz
Do not write a 'restrict' line to the NTP config if it will be empty. Fixes #7110
-rw-r--r--src/etc/inc/system.inc22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc
index 93480e5..a9a822a 100644
--- a/src/etc/inc/system.inc
+++ b/src/etc/inc/system.inc
@@ -1840,35 +1840,37 @@ function system_ntp_configure() {
if (is_array($config['ntpd']['restrictions']) && is_array($config['ntpd']['restrictions']['row'])) {
$networkacl = $config['ntpd']['restrictions']['row'];
foreach ($networkacl as $acl) {
- $ntpcfg .= "\nrestrict ";
+ $restrict = "";
if (is_ipaddrv6($acl['acl_network'])) {
- $ntpcfg .= "{$acl['acl_network']} mask " . gen_subnet_mask_v6($acl['mask']) . " ";
+ $restrict .= "{$acl['acl_network']} mask " . gen_subnet_mask_v6($acl['mask']) . " ";
} elseif (is_ipaddrv4($acl['acl_network'])) {
- $ntpcfg .= "{$acl['acl_network']} mask " . gen_subnet_mask($acl['mask']) . " ";
+ $restrict .= "{$acl['acl_network']} mask " . gen_subnet_mask($acl['mask']) . " ";
} else {
continue;
}
if (!empty($acl['kod'])) {
- $ntpcfg .= ' kod limited';
+ $restrict .= ' kod limited';
}
if (!empty($acl['nomodify'])) {
- $ntpcfg .= ' nomodify';
+ $restrict .= ' nomodify';
}
if (!empty($acl['noquery'])) {
- $ntpcfg .= ' noquery';
+ $restrict .= ' noquery';
}
if (!empty($acl['nopeer'])) {
- $ntpcfg .= ' nopeer';
+ $restrict .= ' nopeer';
}
if (!empty($acl['noserve'])) {
- $ntpcfg .= ' noserve';
+ $restrict .= ' noserve';
}
if (!empty($acl['notrap'])) {
- $ntpcfg .= ' notrap';
+ $restrict .= ' notrap';
+ }
+ if (!empty($restrict)) {
+ $ntpcfg .= "\nrestrict {$restrict} ";
}
}
}
- $ntpcfg .= "\n";
/* End Custom Access Restrictions */
/* A leapseconds file is really only useful if this clock is stratum 1 */
OpenPOWER on IntegriCloud