diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-02-11 01:08:24 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-02-11 01:08:24 +0000 |
commit | bfd3e48743b399055876b6df70cf23a964e851eb (patch) | |
tree | bb897ea5aff590c21024f425bae35c272f9d5d59 /usr | |
parent | 019220cee1756ec6e4c0c5504f651a8602ed0ae5 (diff) | |
download | pfsense-bfd3e48743b399055876b6df70cf23a964e851eb.zip pfsense-bfd3e48743b399055876b6df70cf23a964e851eb.tar.gz |
During restore, if m0n0wall is found, change to pfsense so that the configuration can automatically be upgraded.
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/diag_backup.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php index de8917a..4bb6d41 100755 --- a/usr/local/www/diag_backup.php +++ b/usr/local/www/diag_backup.php @@ -61,6 +61,24 @@ if ($_POST) { } else if ($mode == "restore") { if (is_uploaded_file($_FILES['conffile']['tmp_name'])) { if (config_install($_FILES['conffile']['tmp_name']) == 0) { + $command = "/sbin/sysctl -a | grep carp"; + $fd = fopen($_FILES['conffile']['tmp_name']); + if(!$fd) { + syslog(LOG_WARNING, "Warning, could not open " . $_FILES['conffile']['tmp_name']); + return 1; + } + while(!feof($fd)) { + $tmp .= fread($fd,49); + } + fclose($fd); + if(stristr($tmp, "m0n0wall" != FALSE)) { + syslog(LOG_WARNING, "Upgrading m0n0wall configuration to pfsense."); + /* m0n0wall was found in config. convert it. */ + $onlyconsonants = str_replace("m0n0wall", "pfsense", $tmp); + fopen($_FILES['conffile']['tmp_name'], "w"); + fwrite($fd, $tmp); + fclose($fd); + } system_reboot(); $savemsg = "The configuration has been restored. The firewall is now rebooting."; } else { |