summaryrefslogtreecommitdiffstats
path: root/etc/inc/xmlparse.inc
diff options
context:
space:
mode:
authorDarren Embry <dse@webonastick.com>2012-05-17 17:30:24 -0400
committerDarren Embry <dse@webonastick.com>2012-05-17 17:30:24 -0400
commit428c289fb4c69a08f6ff1babc049b64c7398daf4 (patch)
tree61aa1e13c42acf87642f58fb70513d99214fb88b /etc/inc/xmlparse.inc
parentff9fbc7b3cc0d61837069681060cf8a8396f5b73 (diff)
downloadpfsense-428c289fb4c69a08f6ff1babc049b64c7398daf4.zip
pfsense-428c289fb4c69a08f6ff1babc049b64c7398daf4.tar.gz
allow null to be passed as 2nd arg to parse_config_xml*
in which case entire config is returned
Diffstat (limited to 'etc/inc/xmlparse.inc')
-rw-r--r--etc/inc/xmlparse.inc25
1 files changed, 14 insertions, 11 deletions
diff --git a/etc/inc/xmlparse.inc b/etc/inc/xmlparse.inc
index 08058a8..93f2208 100644
--- a/etc/inc/xmlparse.inc
+++ b/etc/inc/xmlparse.inc
@@ -188,18 +188,21 @@ function parse_xml_config_raw($cffile, $rootobj, $isstring = "false") {
}
xml_parser_free($xml_parser);
- if (!is_array($rootobj))
- $rootobj = array($rootobj);
- foreach ($rootobj as $rootobj_name)
- if ($parsedcfg[$rootobj_name])
- break;
-
- if (!$parsedcfg[$rootobj_name]) {
- log_error(sprintf(gettext("XML error: no %s object found!") . "\n", implode(" or ", $rootobj)));
- return -1;
+ if ($rootobj) {
+ if (!is_array($rootobj))
+ $rootobj = array($rootobj);
+ foreach ($rootobj as $rootobj_name)
+ if ($parsedcfg[$rootobj_name])
+ break;
+
+ if (!$parsedcfg[$rootobj_name]) {
+ log_error(sprintf(gettext("XML error: no %s object found!") . "\n", implode(" or ", $rootobj)));
+ return -1;
+ }
+ return $parsedcfg[$rootobj_name];
+ } else {
+ return $parsedcfg;
}
-
- return $parsedcfg[$rootobj_name];
}
function dump_xml_config_sub($arr, $indent) {
OpenPOWER on IntegriCloud