Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

/usr/local/www/system.php: strip excess whitespace from ntp field #863

Merged
merged 1 commit into from

2 participants

@dhiltonp

It's easy to have a little too much whitespace in the ntp field.

Instead of telling us that we have an invalid ntp server name, let's remove the error condition by merging all consecutive whitespace and then trimming starting/ending whitespace.

@dhiltonp

I'm guessing all the core devs are away for christmas?

@cbuechler cbuechler merged commit 9172982 into pfsense:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 12, 2013
  1. @dhiltonp
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 0 deletions.
  1. +3 −0  usr/local/www/system.php
View
3  usr/local/www/system.php
@@ -155,6 +155,9 @@ function is_timezone($elt) {
if (($t < 0) || (($t > 0) && ($t < 6)) || ($t > 1440)) {
$input_errors[] = gettext("The time update interval must be either 0 (disabled) or between 6 and 1440.");
}
+ # it's easy to have a little too much whitespace in the field, clean it up for the user before processing.
+ $_POST['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $_POST['timeservers']);
+ $_POST['timeservers'] = trim($_POST['timeservers']);
foreach (explode(' ', $_POST['timeservers']) as $ts) {
if (!is_domain($ts)) {
$input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'.");
Something went wrong with that request. Please try again.