diff options
author | jim-p <jimp@pfsense.org> | 2017-01-11 08:53:24 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2017-01-11 08:54:08 -0500 |
commit | 6ca5c3ca6f257db8648e4fafe1443158c915ff8a (patch) | |
tree | 588f63258f3f05e404417c5ea0d64506a569eaf8 /src/etc | |
parent | 00a9abb934149d919693e63a9e78aea6748e1447 (diff) | |
download | pfsense-6ca5c3ca6f257db8648e4fafe1443158c915ff8a.zip pfsense-6ca5c3ca6f257db8648e4fafe1443158c915ff8a.tar.gz |
Do not write a 'restrict' line to the NTP config if it will be empty. Fixes #7110
Diffstat (limited to 'src/etc')
-rw-r--r-- | src/etc/inc/system.inc | 22 |
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 */ |