From 990d7c037ca44700c30a6cd8bbd877c246944a5d Mon Sep 17 00:00:00 2001 From: Erik Fonnesbeck Date: Fri, 26 Nov 2010 15:49:08 -0700 Subject: Check for pfsense root object name in config.xml as a fallback if the configured name is not found. --- etc/inc/xmlparse.inc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'etc/inc/xmlparse.inc') 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) { -- cgit v1.1