aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xinclude/nms/web.pm23
-rwxr-xr-xweb/nms.gathering.org/api/private/port-state2
-rwxr-xr-xweb/nms.gathering.org/api/public/switch-state2
3 files changed, 2 insertions, 25 deletions
diff --git a/include/nms/web.pm b/include/nms/web.pm
index 2b39911..74f40c1 100755
--- a/include/nms/web.pm
+++ b/include/nms/web.pm
@@ -16,7 +16,6 @@ our @EXPORT = qw(finalize_output json dbh db_safe_quote %get_params get_input %j
our $dbh;
our $now;
our $when;
-our $ifname;
our %cc;
sub get_input {
@@ -61,23 +60,6 @@ sub setwhen {
return $when;
}
-sub ispublic() {
- if (defined($get_params{'public'}) || $ENV{'REMOTE_USER'} eq "public") {
- return 1;
- } else {
- return 0;
- }
-}
-# Sets the ifname. If we are logged in, it's simply set to "ifname", otherwise
-# it's hashed for anonymization.
-sub obfuscateifname {
- my $ifname = "ifname";
- if (defined($get_params{'public'})) {
- $ifname = "regexp_replace(ifname, 'ge-0/0/(([0-3][0-9])|(4[0-3])|([0-9]))\$',concat('ge-participant',sha1_hmac(ifname::bytea,'".$nms::config::nms_hash."'::bytea))) as ifname";
- }
- return $ifname;
-}
-
sub finalize_output {
my $query;
$query = $dbh->prepare ('select ' . $now . ' as time;');
@@ -104,11 +86,6 @@ BEGIN {
$dbh = nms::db_connect();
populate_params();
- # FIXME: Shouldn't be magic.
- # Only used for setting time in result from DB time.
- # FIXME: Clarification, this _has_ to be set before setwhen is run,
- # since it secretly overrides it.
$when = setwhen();
- $ifname = obfuscateifname();
}
1;
diff --git a/web/nms.gathering.org/api/private/port-state b/web/nms.gathering.org/api/private/port-state
index 6410805..1f30181 100755
--- a/web/nms.gathering.org/api/private/port-state
+++ b/web/nms.gathering.org/api/private/port-state
@@ -6,7 +6,7 @@ use nms::web;
use strict;
use warnings;
-my $query = 'select sysname,extract(epoch from date_trunc(\'second\',time)) as time, '.$nms::web::ifname.',ifhighspeed,ifhcinoctets,ifhcoutoctets from polls natural join switches where time in (select max(time) from polls where ' . $nms::web::when . ' group by switch,ifname);';
+my $query = 'select sysname,extract(epoch from date_trunc(\'second\',time)) as time, ifname,ifhighspeed,ifhcinoctets,ifhcoutoctets from polls natural join switches where time in (select max(time) from polls where ' . $nms::web::when . ' group by switch,ifname);';
my $q = $nms::web::dbh->prepare($query);
$q->execute();
diff --git a/web/nms.gathering.org/api/public/switch-state b/web/nms.gathering.org/api/public/switch-state
index 81e8d91..e494e6d 100755
--- a/web/nms.gathering.org/api/public/switch-state
+++ b/web/nms.gathering.org/api/public/switch-state
@@ -6,7 +6,7 @@ use nms::web;
use strict;
use warnings;
-my $query = 'select sysname,extract(epoch from date_trunc(\'second\',time)) as time, '.$nms::web::ifname.',ifhighspeed,ifhcinoctets,ifhcoutoctets from polls natural join switches where time in (select max(time) from polls where ' . $nms::web::when . ' group by switch,ifname);';
+my $query = 'select sysname,extract(epoch from date_trunc(\'second\',time)) as time, ifname,ifhighspeed,ifhcinoctets,ifhcoutoctets from polls natural join switches where time in (select max(time) from polls where ' . $nms::web::when . ' group by switch,ifname);';
my $q = $nms::web::dbh->prepare($query);
$q->execute();