diff options
author | Erik Fonnesbeck <efonnes@gmail.com> | 2010-11-18 02:11:36 -0700 |
---|---|---|
committer | Erik Fonnesbeck <efonnes@gmail.com> | 2010-11-18 02:34:51 -0700 |
commit | 0bee20108d6e6f5750b0164a3740a75bb411b77f (patch) | |
tree | 958a6d65d7a199df3adc7d0192d9ee68d204c3d4 /usr | |
parent | b8d4d7cdc5e89ca5ef41ee69fcc4d74f494db573 (diff) | |
download | pfsense-0bee20108d6e6f5750b0164a3740a75bb411b77f.zip pfsense-0bee20108d6e6f5750b0164a3740a75bb411b77f.tar.gz |
Save the host name and domain to a temporary location until the setup wizard is finished to prevent triggering the DNS rebind message. Fixes #1022 Also use this information to implement the redirect for changed host for ticket #455
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/wizard.php | 5 | ||||
-rw-r--r-- | usr/local/www/wizards/setup_wizard.xml | 16 |
2 files changed, 18 insertions, 3 deletions
diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php index d52c738..493fab1 100755 --- a/usr/local/www/wizard.php +++ b/usr/local/www/wizard.php @@ -930,7 +930,10 @@ function fixup_string($string) { if ($host_if && is_ipaddr($config['interfaces'][$host_if]['ipaddr'])) $urlhost = $config['interfaces'][$host_if]['ipaddr']; } - } + } else if ($urlhost == $config['system']['hostname']) + $urlhost = $config['wizardtemp']['system']['hostname']; + else if ($urlhost == $config['system']['hostname'] . '.' . $config['system']['domain']) + $urlhost = $config['wizardtemp']['system']['hostname'] . '.' . $config['wizardtemp']['system']['domain']; } if($urlhost != $http_host) file_put_contents("{$g['tmp_path']}/setupwizard_lastreferrer", $proto . "://" . $http_host . $urlport . $_SERVER['REQUEST_URI']); diff --git a/usr/local/www/wizards/setup_wizard.xml b/usr/local/www/wizards/setup_wizard.xml index aad3a59..6b0627c 100644 --- a/usr/local/www/wizards/setup_wizard.xml +++ b/usr/local/www/wizards/setup_wizard.xml @@ -57,7 +57,7 @@ <field> <name>Hostname</name> <type>input</type> - <bindstofield>system->hostname</bindstofield> + <bindstofield>wizardtemp->system->hostname</bindstofield> <description>EXAMPLE: myserver</description> <validate>^[a-z0-9.|-]+$</validate> <message>Invalid Hostname</message> @@ -65,7 +65,7 @@ <field> <name>Domain</name> <type>input</type> - <bindstofield>system->domain</bindstofield> + <bindstofield>wizardtemp->system->domain</bindstofield> <description>EXAMPLE: mydomain.com</description> <validate>^[a-z0-9.|-]+$</validate> <message>Domain name field is invalid</message> @@ -99,6 +99,14 @@ <type>submit</type> </field> </fields> + <stepbeforeformdisplay> + <![CDATA[ + $config['wizardtemp'] = array(); + $config['wizardtemp']['system'] = array(); + $config['wizardtemp']['system']['hostname'] = $config['system']['hostname']; + $config['wizardtemp']['system']['domain'] = $config['system']['domain']; + ]]> + </stepbeforeformdisplay> <stepsubmitphpaction> <![CDATA[ if(empty($_POST['hostname']) || !is_hostname($_POST['hostname'])) { @@ -553,6 +561,10 @@ <description>A reload is now in progress. Please wait. <p> The system will automatically try to access $myurl in 120 seconds. <p> You can click on the icon above to access the site more quickly. <meta http-equiv="refresh" content="60; url=$myurl" ></description> <stepafterformdisplay> + $config['system']['hostname'] = $config['wizardtemp']['system']['hostname']; + $config['system']['domain'] = $config['wizardtemp']['system']['domain']; + unset($config['wizardtemp']); + write_config(); reload_all(); mwexec_bg("/etc/rc.update_bogons.sh now"); </stepafterformdisplay> |