1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#!/usr/bin/perl -T
use strict;
use warnings;
use Sys::Utmp;
use Test::More;
eval "use Scalar::Util qw(tainted)";
#plan skip_all => "Tainting check skipped";
if ( $@ )
{
plan skip_all => "Need Scalar::Util to test tainting";
}
else
{
plan tests => 2;
}
my $utmp = Sys::Utmp->new();
my $utent = $utmp->getutent();
SKIP: {
skip "no utmp entries", 2 if ! $utent;
ok(tainted($utent->ut_user()),"ut_user is tainted");
ok(tainted($utent->ut_host()),"ut_host is tainted");
}
|