From 44ab46bc871512398c0246f6db809db91e237f42 Mon Sep 17 00:00:00 2001 From: Trevor Paskett - K7FPV Date: Fri, 8 Jan 2016 18:04:25 -0700 Subject: [PATCH] move new settings to optional area under table, disable ntp server, ntp server fqdn validation --- CONTRIBUTORS | 1 + files/etc/config.ap/system | 1 + files/etc/config.client/system | 1 + files/etc/config.mesh/system | 1 + files/etc/config.mesh_ap/system | 1 + files/etc/config.router/system | 1 + files/www/cgi-bin/perlfunc.pm | 11 +++++- files/www/cgi-bin/setup | 65 +++++++++++++++++++-------------- 8 files changed, 54 insertions(+), 28 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index f98bd521..b8dc6aec 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2,3 +2,4 @@ David Rivenburg Conrad Lara - KG6JEI Darryl Quinn - K5DLQ Joe Ayers - AE6XE +Trevor Paskett - K7FPV diff --git a/files/etc/config.ap/system b/files/etc/config.ap/system index 97b77a40..584689bb 100644 --- a/files/etc/config.ap/system +++ b/files/etc/config.ap/system @@ -5,6 +5,7 @@ config 'system' config 'timeserver' 'ntp' list 'server' '' option enable_server 0 + option enabled 0 config button option button 'reset' diff --git a/files/etc/config.client/system b/files/etc/config.client/system index 97b77a40..584689bb 100644 --- a/files/etc/config.client/system +++ b/files/etc/config.client/system @@ -5,6 +5,7 @@ config 'system' config 'timeserver' 'ntp' list 'server' '' option enable_server 0 + option enabled 0 config button option button 'reset' diff --git a/files/etc/config.mesh/system b/files/etc/config.mesh/system index 97b77a40..584689bb 100644 --- a/files/etc/config.mesh/system +++ b/files/etc/config.mesh/system @@ -5,6 +5,7 @@ config 'system' config 'timeserver' 'ntp' list 'server' '' option enable_server 0 + option enabled 0 config button option button 'reset' diff --git a/files/etc/config.mesh_ap/system b/files/etc/config.mesh_ap/system index 97b77a40..584689bb 100644 --- a/files/etc/config.mesh_ap/system +++ b/files/etc/config.mesh_ap/system @@ -5,6 +5,7 @@ config 'system' config 'timeserver' 'ntp' list 'server' '' option enable_server 0 + option enabled 0 config button option button 'reset' diff --git a/files/etc/config.router/system b/files/etc/config.router/system index 97b77a40..584689bb 100644 --- a/files/etc/config.router/system +++ b/files/etc/config.router/system @@ -5,6 +5,7 @@ config 'system' config 'timeserver' 'ntp' list 'server' '' option enable_server 0 + option enabled 0 config button option button 'reset' diff --git a/files/www/cgi-bin/perlfunc.pm b/files/www/cgi-bin/perlfunc.pm index b7d51aec..36e0c079 100644 --- a/files/www/cgi-bin/perlfunc.pm +++ b/files/www/cgi-bin/perlfunc.pm @@ -851,10 +851,19 @@ sub validate_hostname $host =~ s/^\s+//; $host =~ s/\s+$//; return 0 if $host =~ /_/; - return 1 if $host =~ /^[\w\-]+$/; + return 1 if $host =~ /^[\w\-\.]+$/; return 0; } +# validate_fqdn from http://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address + +sub validate_fqdn { + my $testval = shift(@_); + ( $testval =~ m/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]+)\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/ ) + ? return 1 + : return 0; +} + sub validate_port { my($port) = @_; diff --git a/files/www/cgi-bin/setup b/files/www/cgi-bin/setup index ec0d1cfd..95786ed9 100755 --- a/files/www/cgi-bin/setup +++ b/files/www/cgi-bin/setup @@ -412,7 +412,7 @@ if($parms{button_save}) push(@errors, "invalid tactical name"); } - if($ntp_server eq '') + if($ntp_server eq '' || validate_fqdn($ntp_server) == 0) { push(@errors, "invalid ntp server"); } @@ -602,30 +602,6 @@ print " Verify Password "; -print "
"; -print "Latitude"; -print ""; -if($pingOk) -{ - print " "; -} else { - print " "; -} -print ""; -print "\n"; -print "Longitude"; -print "Grid Square\n"; - -print " -Timezone -NTP Server"; - print " @@ -641,7 +617,6 @@ if($config ne "mesh") print "
"; -print "
" if($pingOk); print "
\n"; # @@ -797,8 +772,8 @@ else push @hidden, ""; push @hidden, ""; } -print "
\n"; +print "\n"; # # LAN settings @@ -985,6 +960,42 @@ print " \n"; +# +# Optional Settings +# + +print "\n"; +print ""; + +print ""; +print "\n"; +print ""; +print "\n"; + +print " + +"; + +print "
Optional Settings
Latitude"; +if($pingOk) +{ + print " "; +} else { + print " "; +} +print ""; +print "
LongitudeGrid Square
TimezoneNTP Server
"; + +print ""; +print "
" if($pingOk); +print ""; + print "\n"; push @hidden, "";