From a2208dbc5ac143a85bc6e038afd24bd18e9f461f Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Sun, 5 Mar 2017 16:57:37 -0800 Subject: [PATCH] bugfix: Prevent users from uploading files when tunnels are active. If a user tries to upload a file (especially firmware images) while a tunnel is active the nodes run a high risk of running out of available RAM. Change-Id: I6c31a5c641c7266f337aa4b209367ae0491703ad --- files/www/cgi-bin/admin | 31 +++++++++++++++++++++++++++---- files/www/help.html | 7 +++++++ 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/files/www/cgi-bin/admin b/files/www/cgi-bin/admin index 4e9e5fea..37587363 100755 --- a/files/www/cgi-bin/admin +++ b/files/www/cgi-bin/admin @@ -57,7 +57,24 @@ sub firmware_list_gen $debug = 0; $| = 1; -read_postdata({acceptfile => true}); + +$tunnel_active= 0; +if ( -e "/usr/sbin/vtund" && open(my $tuncfgfd, '/etc/config/vtun')) { + while ( my $line = <$tuncfgfd> ) { + if ( $line =~ /option enabled '1'/i ) { + $tunnel_active = 1; + last; + } + } +} + + +if ( $tunnel_active ) { + read_postdata({acceptfile => false}); +} else { + read_postdata({acceptfile => true}); +} + reboot_page("/cgi-bin/status") if $parms{button_reboot}; read_query_string(); $node = nvram_get("node"); @@ -557,7 +574,9 @@ print "current version: $fw_version\n"; print "\n"; print "Upload Firmware\n"; print "\n"; -print "\n"; +print "\n"; print "\n"; print "\n"; @@ -601,7 +620,9 @@ if(@pkg_output) print "\n"; print "Upload Package\n"; print " \n"; -print "\n"; +print "\n"; print "\n"; print "\n"; @@ -652,7 +673,9 @@ if(@key_output) print "\n"; print "Upload Key\n"; print "\n"; -print "\n"; +print "\n"; print "\n"; print "\n"; diff --git a/files/www/help.html b/files/www/help.html index 68d32d48..e1704982 100644 --- a/files/www/help.html +++ b/files/www/help.html @@ -644,6 +644,13 @@ size will be translated into the new subnet address space.




Administration

+

+Note:
Files can not be uploaded to a node while a tunnel +server or client connection is enabled. To upload any file (firmware, package +or ssh key) you must ensure all tunnel servers and clients are disabled.
+Upload buttons will be disabled until tunnels are disabled. +

+

Firmware Update is how new firmware is installed on the node. If you have a firmware image on your computer, click