summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
Diffstat (limited to 'etc/inc')
-rw-r--r--etc/inc/config.lib.inc4
-rw-r--r--etc/inc/xmlparse.inc12
-rw-r--r--etc/inc/xmlreader.inc8
3 files changed, 18 insertions, 6 deletions
diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc
index f8c408d..f466226 100644
--- a/etc/inc/config.lib.inc
+++ b/etc/inc/config.lib.inc
@@ -148,7 +148,7 @@ function parse_config($parse = false) {
die("Config.xml is corrupted and is 0 bytes. Could not restore a previous backup.");
}
}
- $config = parse_xml_config($g['conf_path'] . '/config.xml', $g['xml_rootobj']);
+ $config = parse_xml_config($g['conf_path'] . '/config.xml', array($g['xml_rootobj'], 'pfsense'));
if($config == "-1") {
$last_backup = discover_last_backup();
if ($last_backup)
@@ -722,7 +722,7 @@ function cleanup_backupcache($revisions = 30, $lock = false) {
$i = true;
if($g['booting'])
echo ".";
- $newxml = parse_xml_config($backup, $g['xml_rootobj']);
+ $newxml = parse_xml_config($backup, array($g['xml_rootobj'], 'pfsense'));
if($newxml == "-1") {
log_error("The backup cache file $backup is corrupted. Unlinking.");
unlink($backup);
diff --git a/etc/inc/xmlparse.inc b/etc/inc/xmlparse.inc
index 582f9b4..9f44e21 100644
--- a/etc/inc/xmlparse.inc
+++ b/etc/inc/xmlparse.inc
@@ -187,12 +187,18 @@ function parse_xml_config_raw($cffile, $rootobj, $isstring = "false") {
}
xml_parser_free($xml_parser);
- if (!$parsedcfg[$rootobj]) {
- log_error("XML error: no $rootobj object found!\n");
+ if (!is_array($rootobj))
+ $rootobj = array($rootobj);
+ foreach ($rootobj as $rootobj_name)
+ if ($parsedcfg[$rootobj_name])
+ break;
+
+ if (!$parsedcfg[$rootobj_name]) {
+ log_error("XML error: no $rootobj_name object found!\n");
return -1;
}
- return $parsedcfg[$rootobj];
+ return $parsedcfg[$rootobj_name];
}
function dump_xml_config_sub($arr, $indent) {
diff --git a/etc/inc/xmlreader.inc b/etc/inc/xmlreader.inc
index a228cd0..0beeb74 100644
--- a/etc/inc/xmlreader.inc
+++ b/etc/inc/xmlreader.inc
@@ -128,7 +128,13 @@ function parse_xml_config_raw($cffile, $rootobj, $isstring = "false") {
} else
log_error("Error returned while trying to parse {$cffile}");
- return $parsedcfg[$rootobj];
+ if (!is_array($rootobj))
+ $rootobj = array($rootobj);
+ foreach ($rootobj as $rootobj_name)
+ if ($parsedcfg[$rootobj_name])
+ break;
+
+ return $parsedcfg[$rootobj_name];
}
function dump_xml_config_sub(& $writer, $arr) {
OpenPOWER on IntegriCloud