From 39bfb267b1c44742afef724e65bfce2e2b2870d3 Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Sat, 23 Apr 2016 01:24:22 -0500 Subject: Hostnames are valid for NTP servers in DHCP Server. Ticket #6239 --- src/usr/local/www/services_dhcp.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/usr/local/www/services_dhcp.php') diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php index 1b485fc..031b62c 100644 --- a/src/usr/local/www/services_dhcp.php +++ b/src/usr/local/www/services_dhcp.php @@ -356,8 +356,8 @@ if (isset($_POST['save'])) { $input_errors[] = gettext("If a mac deny list is specified, it must contain only valid partial MAC addresses."); } - if (($_POST['ntp1'] && !is_ipaddrv4($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddrv4($_POST['ntp2']))) { - $input_errors[] = gettext("A valid IP address must be specified for the primary/secondary NTP servers."); + if (($_POST['ntp1'] && (!is_ipaddrv4($_POST['ntp1']) && !is_hostname($_POST['ntp1']))) || ($_POST['ntp2'] && (!is_ipaddrv4($_POST['ntp2']) && !is_hostname($_POST['ntp2'])))) { + $input_errors[] = gettext("A valid IP address or hostname must be specified for the primary/secondary NTP servers."); } if (($_POST['domain'] && !is_domain($_POST['domain']))) { $input_errors[] = gettext("A valid domain name must be specified for the DNS domain."); @@ -1094,13 +1094,13 @@ $section->addInput(new Form_IpAddress( 'ntp1', 'NTP Server 1', $pconfig['ntp1'] -)); +))->setPattern('[.a-zA-Z0-9_]+'); $section->addInput(new Form_IpAddress( 'ntp2', 'NTP Server 2', $pconfig['ntp2'] -)); +))->setPattern('[.a-zA-Z0-9_]+'); // Advanced TFTP $btnadv = new Form_Button( -- cgit v1.1