line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Umlmgr::Utils; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
34
|
use 5.010000; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
67
|
|
4
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
59
|
|
5
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
64
|
|
6
|
2
|
|
|
2
|
|
9
|
use POSIX; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub get_id { |
9
|
0
|
|
|
0
|
0
|
|
my ($user) = @_; |
10
|
0
|
0
|
|
|
|
|
my @pwnam = POSIX::getpwnam($user) or return; |
11
|
0
|
|
|
|
|
|
$pwnam[2] |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub become_user { |
15
|
0
|
|
|
0
|
0
|
|
my ($user) = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
0
|
|
|
|
if ($< != 0 && $> != 0) { return 1 } |
|
0
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
|
my $id = get_id($user) or return; |
19
|
|
|
|
|
|
|
#$> = $< = $id; |
20
|
0
|
0
|
|
|
|
|
if (POSIX::setuid($id)) { |
21
|
0
|
|
|
|
|
|
my @puid = POSIX::getpwuid($id); |
22
|
0
|
|
|
|
|
|
POSIX::setgid($puid[3]); |
23
|
0
|
|
|
|
|
|
$ENV{HOME} = $puid[7]; |
24
|
0
|
|
|
|
|
|
$ENV{TMP} = "$puid[7]/tmp"; |
25
|
0
|
|
|
|
|
|
$ENV{TMPDIR} = "$puid[7]/tmp"; |
26
|
0
|
|
|
|
|
|
$ENV{USER} = $user; |
27
|
0
|
|
|
|
|
|
return 1; |
28
|
0
|
|
|
|
|
|
} else { return } |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Preloaded methods go here. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
__END__ |