line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Unix::SavedIDs; |
2
|
|
|
|
|
|
|
|
3
|
11
|
|
|
11
|
|
230183
|
use strict; |
|
11
|
|
|
|
|
23
|
|
|
11
|
|
|
|
|
278
|
|
4
|
11
|
|
|
11
|
|
46
|
use warnings; |
|
11
|
|
|
|
|
30
|
|
|
11
|
|
|
|
|
288
|
|
5
|
11
|
|
|
11
|
|
46
|
use Carp; |
|
11
|
|
|
|
|
25
|
|
|
11
|
|
|
|
|
830
|
|
6
|
11
|
|
|
11
|
|
19570
|
use Data::Dumper; |
|
11
|
|
|
|
|
117502
|
|
|
11
|
|
|
|
|
827
|
|
7
|
|
|
|
|
|
|
use constant { |
8
|
11
|
|
|
|
|
974
|
TYPE_UID => 0, |
9
|
|
|
|
|
|
|
TYPE_GID => 1, |
10
|
11
|
|
|
11
|
|
86
|
}; |
|
11
|
|
|
|
|
22
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $DEBUG = 0; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
BEGIN { |
15
|
|
|
|
|
|
|
|
16
|
11
|
|
|
11
|
|
56
|
use Exporter (); |
|
11
|
|
|
|
|
12
|
|
|
11
|
|
|
|
|
726
|
|
17
|
11
|
|
|
11
|
|
32
|
our ($VERSION,@ISA,@EXPORT); |
18
|
11
|
|
|
|
|
100
|
@ISA = qw(Exporter); |
19
|
11
|
|
|
|
|
33
|
@EXPORT = qw(getresuid getresgid setresuid setresgid |
20
|
|
|
|
|
|
|
); |
21
|
11
|
|
|
|
|
22
|
$VERSION = 0.004003; |
22
|
11
|
|
|
11
|
|
46
|
use XSLoader; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
331
|
|
23
|
11
|
|
|
|
|
8977
|
XSLoader::load('Unix::SavedIDs',$VERSION); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub setresuid { |
27
|
0
|
|
|
0
|
1
|
|
my @args = eval {_clean_args(@_) }; |
|
0
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
if ( $@ ) { |
29
|
0
|
|
|
|
|
|
croak "setresuid(): $@"; |
30
|
|
|
|
|
|
|
} |
31
|
0
|
|
|
|
|
|
_setresuid(@args); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub setresgid { |
35
|
0
|
|
|
0
|
1
|
|
my @args = eval {_clean_args(@_) }; |
|
0
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
if ( $@ ) { |
37
|
0
|
|
|
|
|
|
croak "setresgid(): $@"; |
38
|
|
|
|
|
|
|
} |
39
|
0
|
|
|
|
|
|
_setresgid(@args); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _clean_args { |
43
|
0
|
|
|
0
|
|
|
my @args = @_; |
44
|
0
|
|
|
|
|
|
my $is_int = qr/^-?\d+$/o; |
45
|
0
|
|
|
|
|
|
for my $num ( 0 .. 2 ) { |
46
|
0
|
0
|
0
|
|
|
|
if ( !exists($args[$num]) || !defined($args[$num]) ) { |
47
|
0
|
|
|
|
|
|
$args[$num] = -1; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
else { |
50
|
0
|
0
|
|
|
|
|
if ( $args[$num] !~ $is_int ) { |
51
|
0
|
|
|
|
|
|
croak 'bad arg \''.$args[$num].'\'. Must be int.'."\n"; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
0
|
0
|
|
|
|
|
if (@args != 3) { |
56
|
0
|
|
|
|
|
|
die "_clean_args should always produce 3 args. THIS IS A BUG!"; |
57
|
|
|
|
|
|
|
} |
58
|
0
|
|
|
|
|
|
return @args; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |