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:12 -0500 |
commit | 59c6b72e0b65476f0764840fd042f770704bff60 (patch) | |
tree | 09f3a4691891cd8748d15ced076d858bba1dddc8 | |
parent | 55e0a1a0cc6c203de65550033e132420b2d1bc87 (diff) | |
download | pfsense-59c6b72e0b65476f0764840fd042f770704bff60.zip pfsense-59c6b72e0b65476f0764840fd042f770704bff60.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.inc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index 36071dc..030a746 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -1819,35 +1819,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 */ |