ext-sources/ucredtest.py
author daniell
Wed, 13 Oct 2010 16:43:58 +0000
branchopensolaris-2009-06
changeset 20159 f18a6979f732
parent 12074 9b55b0eb183a
child 17113 9566f46ad3bb
permissions -rw-r--r--
6965295 [CVE-2010-1205/CVE-2010-2249] Multiple security issues in libpng 1.2 versions before 1.2.44

#!/usr/bin/python

import ucred
import os

uc = ucred.get(os.getpid())

print "pid = %d" % uc.getpid()
print "euid = %d" % uc.geteuid()
print "ruid = %d" % uc.getruid()
print "suid = %d" % uc.getsuid()
print "egid = %d" % uc.getegid()
print "rgid = %d" % uc.getrgid()
print "sgid = %d" % uc.getsgid()
print "zoneid = %d" % uc.getzoneid()
print "projid = %d" % uc.getprojid()
print "groups = %s" % uc.getgroups()
print "label = %s" % uc.getlabel()

print "getpflags(0x1) = %d" % uc.getpflags(0x1)
print "getpflags(0x2) = %d" % uc.getpflags(0x2)
print "has_priv(Effective, proc_fork) = %d" % uc.has_priv("Effective", "proc_fork")
print "has_priv(Permitted, proc_fork) = %d" % uc.has_priv("Permitted", "proc_fork")
print "has_priv(Inheritable, proc_fork) = %d" % uc.has_priv("Inheritable", "proc_fork")
print "has_priv(Limit, file_setid) = %d" % uc.has_priv("Limit", "file_setid")
print "has_priv(Effective, file_setid) = %d" % uc.has_priv("Effective", "file_setid")
try:
    uc.has_priv("Effective", "proc_bork")
except OSError, e:
    print e
try:
    uc.has_priv("Defective", "proc_fork")
except OSError, e:
    print e
try:
    uc.has_priv("Defective", "proc_bork")
except OSError, e:
    print e

del uc
uc = ucred.ucred()
try:
    uc.getpid()
except OSError, e:
    print e