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)) {
die("*** $0:\n".
" Could not exec $newpath: $!");
}
if (EmulabFeatures->FeatureEnabled("PortfixSnmpit", $this_user, undef, 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: $!");
# Check feature access for both the user and the projects they belong to
# for the portfix version of snmpit. The user should be a member of at least
# one project, so we will get into the foreach loop to check 'global' and
# 'user' permissions as well.
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";
exec $newpath, @ARGV;
die("*** $0:\n".
......
......@@ -39,10 +39,11 @@ use libtestbed;
use EmulabFeatures;
#
# See if we use the alternate version of snmpit. Only user and
# global checks are done.
# See if we use the alternate version of snmpit. Only user, global
# and default group checks are performed.
#
my $this_user;
my $user_def_pid;
if ($UID) {
$this_user = User->ThisUser();
......@@ -63,12 +64,23 @@ if (EmulabFeatures->FeatureEnabled("OldSnmpit", $this_user, undef, undef)) {
" Could not exec $newpath: $!");
}
if (EmulabFeatures->FeatureEnabled("PortfixSnmpit", $this_user, undef, 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: $!");
# Check feature access for both the user and the projects they belong to
# for the portfix version of snmpit. The user should be a member of at least
# one project, so we will get into the foreach loop to check 'global' and
# 'user' permissions as well.
my @user_projects = ();
$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";
......
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