From 1b7829ec51a02884fe1497a0e5c89f5ddfc3e735 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Sun, 22 Aug 2010 22:12:32 +0000 Subject: [PATCH] fix unauthenticated graphs via $config['allow_unauth_graphs'] git-svn-id: http://www.observium.org/svn/observer/trunk@1691 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/includes/graphs/application/auth.inc.php | 2 +- html/includes/graphs/atmvp/auth.inc.php | 2 +- html/includes/graphs/bgp/auth.inc.php | 2 +- html/includes/graphs/bill/auth.inc.php | 2 +- html/includes/graphs/customer/auth.inc.php | 2 +- html/includes/graphs/device/auth.inc.php | 2 +- html/includes/graphs/diskio/auth.inc.php | 2 +- html/includes/graphs/graph.inc.php | 28 ++----------------- html/includes/graphs/mempool/auth.inc.php | 2 +- html/includes/graphs/multiport/auth.inc.php | 2 +- html/includes/graphs/port/auth.inc.php | 2 +- html/includes/graphs/processor/auth.inc.php | 2 +- html/includes/graphs/sensor/auth.inc.php | 2 +- html/includes/graphs/service/auth.inc.php | 2 +- html/includes/graphs/storage/auth.inc.php | 2 +- 15 files changed, 17 insertions(+), 39 deletions(-) diff --git a/html/includes/graphs/application/auth.inc.php b/html/includes/graphs/application/auth.inc.php index 80256e0a5..b3e9aba25 100644 --- a/html/includes/graphs/application/auth.inc.php +++ b/html/includes/graphs/application/auth.inc.php @@ -1,6 +1,6 @@ = "5") +if ($_SESSION['userlevel'] >= "5" || $config['allow_unauth_graphs'];) { $id = mres($_GET['id']); $title = generate_device_link($device); diff --git a/html/includes/graphs/device/auth.inc.php b/html/includes/graphs/device/auth.inc.php index acd186fef..da51ebae7 100644 --- a/html/includes/graphs/device/auth.inc.php +++ b/html/includes/graphs/device/auth.inc.php @@ -1,6 +1,6 @@ [A-Za-z0-9]+)_(?P.+)/', mres($_GET['type']), $graphtype); $type = $graphtype['type']; @@ -55,19 +46,6 @@ if(isset($_GET['debug'])) { $graphfile = $config['temp_dir'] . "/" . strgen() . ".png"; -# $os = gethostosbyid($device_id); -# if($config['os'][$os]['group']) {$os_group = $config['os'][$os]['group'];} -# if(is_file($config['install_dir'] . "/html/includes/graphs/".$type."_".$os.".inc.php")) { -# /// Type + OS Specific -# include($config['install_dir'] . "/html/includes/graphs/".$type."_".$os.".inc.php"); -# }elseif($os_group && is_file($config['install_dir'] . "/html/includes/graphs/".$type."_".$os_group.".inc.php")) { -# /// Type + OS Group Specific -# include($config['install_dir'] . "/html/includes/graphs/".$type."_".$os_group.".inc.php"); -# } elseif(is_file($config['install_dir'] . "/html/includes/graphs/$type.inc.php")) { -# /// Type Specific -# include($config['install_dir'] . "/html/includes/graphs/$type.inc.php"); -# } - if(is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php")) { include($config['install_dir'] . "/html/includes/graphs/$type/auth.inc.php"); if($auth) { diff --git a/html/includes/graphs/mempool/auth.inc.php b/html/includes/graphs/mempool/auth.inc.php index b549cef04..1d9bbca4f 100755 --- a/html/includes/graphs/mempool/auth.inc.php +++ b/html/includes/graphs/mempool/auth.inc.php @@ -5,7 +5,7 @@ if(is_numeric($id)) $sql = mysql_query("SELECT * FROM `mempools` AS C, `devices` AS D where C.`mempool_id` = '".mres($id)."' AND C.device_id = D.device_id"); $mempool = mysql_fetch_assoc($sql); - if(is_numeric($mempool['device_id']) && device_permitted($mempool['device_id'])) + if(is_numeric($mempool['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($mempool['device_id']))) { $device = device_by_id_cache($mempool['device_id']); $rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("mempool-".$mempool['mempool_type']."-".$mempool['mempool_index'].".rrd"); diff --git a/html/includes/graphs/multiport/auth.inc.php b/html/includes/graphs/multiport/auth.inc.php index a789881f7..3291c2760 100644 --- a/html/includes/graphs/multiport/auth.inc.php +++ b/html/includes/graphs/multiport/auth.inc.php @@ -3,7 +3,7 @@ $auth = TRUE; foreach(explode(",", $id) as $ifid) { - if(!port_permitted($ifid)) + if(!$config['allow_unauth_graphs'] && !port_permitted($ifid)) $auth = FALSE; } diff --git a/html/includes/graphs/port/auth.inc.php b/html/includes/graphs/port/auth.inc.php index 336faf318..ce0322ddf 100644 --- a/html/includes/graphs/port/auth.inc.php +++ b/html/includes/graphs/port/auth.inc.php @@ -1,6 +1,6 @@