Commit 8ca2368f authored by Kirk Webb's avatar Kirk Webb

Check the calling user's project membership for feature access too.

For the portfix version of snmpit.
parent 480086c8
...@@ -62,13 +62,26 @@ if (EmulabFeatures->FeatureEnabled("OldSnmpit", $this_user, undef, undef)) { ...@@ -62,13 +62,26 @@ if (EmulabFeatures->FeatureEnabled("OldSnmpit", $this_user, undef, undef)) {
die("*** $0:\n". die("*** $0:\n".
" Could not exec $newpath: $!"); " Could not exec $newpath: $!");
} }
if (EmulabFeatures->FeatureEnabled("PortfixSnmpit", $this_user, undef, undef)) {
my $newpath = "$TB/lib/snmpit_portfix/portstats"; # Check feature access for both the user and the projects they belong to
print STDERR "Invoking alternate portstats from $newpath\n"; # for the portfix version of snmpit. The user should be a member of at least
exec $newpath, @ARGV; # one project, so we will get into the foreach loop to check 'global' and
die("*** $0:\n". # 'user' permissions as well.
" Could not exec $newpath: $!"); my @user_projects = ();
$this_user->ProjectMembershipList(\@user_projects);
foreach my $proj (@user_projects) {
if (EmulabFeatures->FeatureEnabled("PortfixSnmpit",
$this_user,
$proj,
undef)) {
my $newpath = "$TB/lib/snmpit_portfix/portstats";
print STDERR "Invoking alternate portstats from $newpath\n";
exec $newpath, @ARGV;
die("*** $0:\n".
" Could not exec $newpath: $!");
}
} }
my $newpath = "$TB/lib/snmpit_test/portstats"; my $newpath = "$TB/lib/snmpit_test/portstats";
exec $newpath, @ARGV; exec $newpath, @ARGV;
die("*** $0:\n". die("*** $0:\n".
......
...@@ -39,10 +39,11 @@ use libtestbed; ...@@ -39,10 +39,11 @@ use libtestbed;
use EmulabFeatures; use EmulabFeatures;
# #
# See if we use the alternate version of snmpit. Only user and # See if we use the alternate version of snmpit. Only user, global
# global checks are done. # and default group checks are performed.
# #
my $this_user; my $this_user;
my $user_def_pid;
if ($UID) { if ($UID) {
$this_user = User->ThisUser(); $this_user = User->ThisUser();
...@@ -63,12 +64,23 @@ if (EmulabFeatures->FeatureEnabled("OldSnmpit", $this_user, undef, undef)) { ...@@ -63,12 +64,23 @@ if (EmulabFeatures->FeatureEnabled("OldSnmpit", $this_user, undef, undef)) {
" Could not exec $newpath: $!"); " Could not exec $newpath: $!");
} }
if (EmulabFeatures->FeatureEnabled("PortfixSnmpit", $this_user, undef, undef)) { # Check feature access for both the user and the projects they belong to
my $newpath = "$TB/bin/snmpit_portfix"; # for the portfix version of snmpit. The user should be a member of at least
print STDERR "Invoking alternate snmpit from $newpath\n"; # one project, so we will get into the foreach loop to check 'global' and
exec $newpath, @ARGV; # 'user' permissions as well.
die("*** $0:\n". my @user_projects = ();
" Could not exec $newpath: $!"); $this_user->ProjectMembershipList(\@user_projects);
foreach my $proj (@user_projects) {
if (EmulabFeatures->FeatureEnabled("PortfixSnmpit",
$this_user,
$proj,
undef)) {
my $newpath = "$TB/bin/snmpit_portfix";
print STDERR "Invoking alternate snmpit from $newpath\n";
exec $newpath, @ARGV;
die("*** $0:\n".
" Could not exec $newpath: $!");
}
} }
my $newpath = "$TB/bin/snmpit_test"; my $newpath = "$TB/bin/snmpit_test";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment