From 645ec835ab523acee809c762973a3e52918887a3 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 28 Aug 2006 20:10:41 +0000 Subject: Remove special characters from interface descriptions during m0n0wall upgrade. Also unset the config.cache if it exists. --- usr/local/www/diag_backup.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'usr') diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php index 77e1d51..81704c1 100755 --- a/usr/local/www/diag_backup.php +++ b/usr/local/www/diag_backup.php @@ -33,6 +33,10 @@ $omit_nocacheheaders = true; require("guiconfig.inc"); +function remove_bad_chars($string) { + return preg_replace('/[^a-z|_|0-9]/i','',$string); +} + function spit_out_select_items($area) { $select = << @@ -156,10 +160,16 @@ if ($_POST) { unlink("/tmp/config.cache"); $config = parse_config(true); if($m0n0wall_upgrade == true) { - if($config['system']['gateway'] <> "") { + if($config['system']['gateway'] <> "") $config['interfaces']['wan']['gateway'] = $config['system']['gateway']; - } unset($config['shaper']); + /* build an interface collection */ + for ($j = 1; isset ($config['interfaces']['opt' . $j]); $j++) + $ifdescrs['opt' . $j] = "opt" . $j; + /* remove special characters from interface descriptions */ + foreach($ifdescrs as $iface) + $config['interfaces'][$iface]['descr'] = remove_bad_chars($config['interfaces'][$iface]['descr']); + unlink_if_exists("/tmp/config.cache"); write_config(); conf_mount_ro(); $savemsg = "The m0n0wall configuration has been restored and upgraded to pfSense.

The firewall is now rebooting."; @@ -224,7 +234,7 @@ include("head.inc"); $tab_array[0] = array("Remote", false, "diag_confbak.php"); $tab_array[1] = array("Local", true, "diag_backup.php"); display_top_tabs($tab_array); -?> +?> -- cgit v1.1