12074
|
1 |
#!/usr/bin/python
|
|
2 |
|
|
3 |
import ucred
|
|
4 |
import os
|
|
5 |
|
|
6 |
uc = ucred.get(os.getpid())
|
|
7 |
|
|
8 |
print "pid = %d" % uc.getpid()
|
|
9 |
print "euid = %d" % uc.geteuid()
|
|
10 |
print "ruid = %d" % uc.getruid()
|
|
11 |
print "suid = %d" % uc.getsuid()
|
|
12 |
print "egid = %d" % uc.getegid()
|
|
13 |
print "rgid = %d" % uc.getrgid()
|
|
14 |
print "sgid = %d" % uc.getsgid()
|
|
15 |
print "zoneid = %d" % uc.getzoneid()
|
|
16 |
print "projid = %d" % uc.getprojid()
|
|
17 |
print "groups = %s" % uc.getgroups()
|
|
18 |
print "label = %s" % uc.getlabel()
|
|
19 |
|
|
20 |
print "getpflags(0x1) = %d" % uc.getpflags(0x1)
|
|
21 |
print "getpflags(0x2) = %d" % uc.getpflags(0x2)
|
|
22 |
print "has_priv(Effective, proc_fork) = %d" % uc.has_priv("Effective", "proc_fork")
|
|
23 |
print "has_priv(Permitted, proc_fork) = %d" % uc.has_priv("Permitted", "proc_fork")
|
|
24 |
print "has_priv(Inheritable, proc_fork) = %d" % uc.has_priv("Inheritable", "proc_fork")
|
|
25 |
print "has_priv(Limit, file_setid) = %d" % uc.has_priv("Limit", "file_setid")
|
|
26 |
print "has_priv(Effective, file_setid) = %d" % uc.has_priv("Effective", "file_setid")
|
|
27 |
try:
|
|
28 |
uc.has_priv("Effective", "proc_bork")
|
|
29 |
except OSError, e:
|
|
30 |
print e
|
|
31 |
try:
|
|
32 |
uc.has_priv("Defective", "proc_fork")
|
|
33 |
except OSError, e:
|
|
34 |
print e
|
|
35 |
try:
|
|
36 |
uc.has_priv("Defective", "proc_bork")
|
|
37 |
except OSError, e:
|
|
38 |
print e
|
|
39 |
|
|
40 |
del uc
|
|
41 |
uc = ucred.ucred()
|
|
42 |
try:
|
|
43 |
uc.getpid()
|
|
44 |
except OSError, e:
|
|
45 |
print e
|