From d7bc61ed6aef5804a7de9ab71fe76d166e803682 Mon Sep 17 00:00:00 2001 From: dman776 Date: Sat, 15 Jan 2022 21:56:48 -0600 Subject: [PATCH] bugfix: remove filename checks for firmware uploads (#201) * bugfix: remove filename checks for firmware uploads * remove extra variable that are no longer needed --- files/www/cgi-bin/admin | 86 +---------------------------------------- 1 file changed, 2 insertions(+), 84 deletions(-) diff --git a/files/www/cgi-bin/admin b/files/www/cgi-bin/admin index 6905d08f..38b5349e 100755 --- a/files/www/cgi-bin/admin +++ b/files/www/cgi-bin/admin @@ -122,54 +122,6 @@ if($mfg=~ /Ubiquiti/i) $mfgprefix="cpe"; } -if(${hardwaretype} eq "nanostation-m") -{ - ${hardwaretypev}="nano-m"; # Nano XM -} elsif(${hardwaretype} eq "nanostation-m-xw") { - ${hardwaretypev}= "nano-m-xw" ; # Nano XW -} elsif(${hardwaretype} eq "rb-952ui-5ac2nd") { - ${hardwaretypev}= "rb-nor-flash-16M-ac" ; # hAP AC Lite -} elsif(${hardwaretype} =~ /rb-911g-[25]hpnd/i or - ${hardwaretype} =~ /rb-912uag-[25]hpnd/i ) { - ${hardwaretypev}= "nand-large" ; # Basebox 2/5 and QRT 2/5 -} elsif(${hardwaretype} =~ /rb-l[dfhg]+-[25]nd/i or - ${hardwaretype} =~ /rb-lhg-[25]hpnd/i ) { - ${hardwaretypev}= "rb-nor-flash-16M" ; # LHGs & LDFs -} elsif($mfgprefix eq "cpe" ) { - $hwmodel = `/usr/local/bin/get_model`; - chomp($hwmodel); - if($hwmodel =~ /CPE210 v1\.[01]/i) - { - ${hardwaretypev}= "210-220-v1" ; # v1.0/v1.1 - } elsif($hwmodel =~ /CPE210 v2\.0/i) { - ${hardwaretypev}= "210-v2" ; # v2.0 - } elsif($hwmodel =~ /CPE210 v3\.0/i) { - ${hardwaretypev}= "210-v3" ; # v3.0 - } elsif($hwmodel =~ /CPE220 v2\.0/i) { - ${hardwaretypev}= "220-v2" ; # v3.0 - } elsif($hwmodel =~ /CPE220 v3\.0/i) { - ${hardwaretypev}= "220-v3" ; # v3.0 - } elsif($hwmodel =~ /CPE510 v2\.0/i) { - ${hardwaretypev}= "510-v2" ; # v2.0 - } elsif($hwmodel =~ /CPE510 v3\.0/i) { - ${hardwaretypev}= "510-v3" ; # v3.0 - } elsif($hwmodel =~ /CPE510/i) { - ${hardwaretypev}= "510-520-v1" ; # CPE510 V1.0/v1.1 - } elsif($hwmodel =~ /CPE610 v2\.0/i) { - ${hardwaretypev}= "610-v2" ; # CPE610 V2.0 - } elsif($hwmodel =~ /CPE610/i) { - ${hardwaretypev}= "610-v1" ; # CPE610 V1.0 - } elsif($hwmodel =~ /WBS510 v2\.0/i) { - $mfgprefix="wbs"; - ${hardwaretypev}= "510-v2" ; # WBS510 v2.0 - } elsif($hwmodel =~ /WBS210 v1\.[012]/i) { - $mfgprefix="wbs"; - ${hardwaretypev}= "210-v1" ; # WBS210 v1.0/v1.1 - } -} else { - ${hardwaretypev}=${hardwaretype}; -} - # refresh fw if($parms{button_refresh_fw}) { @@ -621,41 +573,7 @@ system "rm -rf /tmp/web/upload $tmpdir" unless $debug; # http_header(); -html_header("$node administration", 0); -print < - function validateFirmwareFilename(elem){ - var hwmfg = "$mfgprefix"; - var hwtype = "${hardwaretypev}"; - var searchstring = ""; - var efn = ""; - if(hwmfg != "cpe"){ - if (hwmfg == "wbs") { - searchstring= ".*wbs" + hwtype + ".*-sysupgrade.bin$\"; - efn = "aredn-$fw_version-$mfgprefix${hardwaretypev}.*-sysupgrade.bin"; - } else { - searchstring= ".*(-|_)" + hwtype + ".*-sysupgrade.bin$\"; - efn = "aredn-$fw_version-$mfgprefix-${hardwaretypev}.*-sysupgrade.bin"; - } - } else { - searchstring= ".*cpe" + hwtype + ".*-sysupgrade.bin$\"; - efn = "aredn-$fw_version-$mfgprefix${hardwaretypev}.*-sysupgrade.bin"; - } - var re = new RegExp(searchstring,"g"); - if(elem.value.match(re)){ - return true; - }else{ - if (confirm('This filename is NOT appropriate for this device!\\n\\nThis device expects a file such as: ' + efn + ' \\n\\n\\nClick OK to continue if you are CERTAIN that the file is correct.')) { - return true; - } else { - elem.value=""; - return false; - } - } - } - -EOF -print ""; +html_header("$node administration", 1); print "
\n"; alert_banner(); print "
\n"; @@ -689,7 +607,7 @@ print "current version: $fw_version\n"; print "hardware type: (${targettype}) $mfgprefix (${hardwaretype})\n"; print "\n"; print "Upload Firmware\n"; -print "\n"; +print "\n"; print "
Disabled: Tunnels enabled";