diff options
author | Phil Davis <phil.davis@inf.org> | 2014-12-12 10:38:38 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2014-12-12 10:38:38 +0545 |
commit | a93bc2994b5c7911edbba7427871996c0596266b (patch) | |
tree | 822d3027685ef5f2005afcdfe89242afd0dc2445 /usr/local/www | |
parent | fcc96054a0935a2eb4aa380ccf0fc8c44987715f (diff) | |
download | pfsense-a93bc2994b5c7911edbba7427871996c0596266b.zip pfsense-a93bc2994b5c7911edbba7427871996c0596266b.tar.gz |
Base URL must be specified when alturlenable on
I had a 2.1.5 system that I was wondering why the dashboard always said it could not check for updates. I discovered it had "Use an unofficial server for firmware upgrades" checked, but the "Base URL" field was empty.
That can easily be checked with input validation - might as well catch dumb things like that.
I thought about making it parse the string to see if it seemed like a "valid" URL. But so many strings seem like valid URLs:
var_dump(parse_url("abc"));
array(1) {
["path"]=>
string(3) "abc"
}
It seemed a bit pointless to bother - if the user puts something in then hope that it might point to something some day.
Diffstat (limited to 'usr/local/www')
-rw-r--r-- | usr/local/www/system_firmware_settings.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/usr/local/www/system_firmware_settings.php b/usr/local/www/system_firmware_settings.php index adafbd4..f5cfd38 100644 --- a/usr/local/www/system_firmware_settings.php +++ b/usr/local/www/system_firmware_settings.php @@ -43,6 +43,13 @@ require("guiconfig.inc"); if ($_POST) { + unset($input_errors); + + /* input validation */ + if(($_POST['alturlenable'] == "yes") && (empty($_POST['firmwareurl']))) { + $input_errors[] = gettext("A Firmware Auto Update Base URL must be specified when \"Use an unofficial server for firmware upgrades\" is enabled."); + } + if (!$input_errors) { if($_POST['alturlenable'] == "yes") { $config['system']['firmware']['alturl']['enable'] = true; |