diff options
| author | Kristian Lyngstol <kly@kly.no> | 2016-03-04 18:40:51 +0000 | 
|---|---|---|
| committer | Kristian Lyngstol <kly@kly.no> | 2016-03-04 18:40:51 +0000 | 
| commit | b4527d6f786ec856f0346a600db81aaf849bb363 (patch) | |
| tree | bde2151f7490f0e07068f34ac9f4427de8bcb212 | |
| parent | 15dde408db57009e1e4e26d969b9b3e6c1e0c255 (diff) | |
NMS: Remove now redundant "Security" things
Better to have proper isolation than this crud.
| -rwxr-xr-x | include/nms/web.pm | 23 | ||||
| -rwxr-xr-x | web/nms.gathering.org/api/private/port-state | 2 | ||||
| -rwxr-xr-x | web/nms.gathering.org/api/public/switch-state | 2 | 
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();  | 
