From 21e8d5e7afe561a698f6e3e6f38c828fecb6b99f Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 3 Feb 2008 01:12:17 +0000 Subject: Before creating a PHP pointer to an array, make sure the section exists. Otherwise this will create a or entry. This BUG / practice plagues many packages. Glad we finally found the culprit. --- packages/openbgpd/openbgpd.inc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'packages') diff --git a/packages/openbgpd/openbgpd.inc b/packages/openbgpd/openbgpd.inc index 70b725c6..8e64c683 100644 --- a/packages/openbgpd/openbgpd.inc +++ b/packages/openbgpd/openbgpd.inc @@ -34,12 +34,14 @@ function openbgpd_install_conf() { conf_mount_rw(); - if($config['installedpackages']['openbgpd']['config']) { + if($config['installedpackages']['openbgpd']['config']) $openbgpd_conf = &$config['installedpackages']['openbgpd']['config'][0]; - $openbgpd_rows = &$config['installedpackages']['openbgpd']['config'][0]['row']; + if($config['installedpackages']['openbgpd']['config'][0]['row']) + $openbgpd_rows = &$config['installedpackages']['openbgpd']['config'][0]['row']; + if($config['installedpackages']['openbgpdgroups']['config']) $openbgpd_groups = &$config['installedpackages']['openbgpdgroups']['config']; + if($config['installedpackages']['openbgpdneighbors']['config']) $openbgpd_neighbors = &$config['installedpackages']['openbgpdneighbors']['config']; - } $fd = fopen("/usr/local/etc/bgpd.conf", "w"); @@ -152,12 +154,16 @@ function deinstall_openbgpd() { function check_group_usage($groupname) { global $config, $g; - if($config['installedpackages']['openbgpd']['config']) { + + if($config['installedpackages']['openbgpd']['config']) $openbgpd_conf = &$config['installedpackages']['openbgpd']['config'][0]; - $openbgpd_rows = &$config['installedpackages']['openbgpd']['config'][0]['row']; + if($config['installedpackages']['openbgpd']['config'][0]['row']) + $openbgpd_rows = &$config['installedpackages']['openbgpd']['config'][0]['row']; + if($config['installedpackages']['openbgpdgroups']['config']) $openbgpd_groups = &$config['installedpackages']['openbgpdgroups']['config']; + if($config['installedpackages']['openbgpdneighbors']['config']) $openbgpd_neighbors = &$config['installedpackages']['openbgpdneighbors']['config']; - } + if(is_array($openbgpd_groups)) { foreach($openbgpd_groups as $group) { foreach($openbgpd_neighbors as $neighbor) { -- cgit v1.2.3