Nouvelle tentative pour

darcs-hash:20040214191247-41617-871f45f0c616ea9ac2fcc736e898bcf0c52cbfea.gz
This commit is contained in:
pauget 2004-02-14 20:12:47 +01:00
parent 60b9eb3456
commit 6932c3e423

View file

@ -232,13 +232,15 @@ def blast_mail(subject, people, filestodiff, contextlines, fromhost):
conn.connect(MAILHOST, MAILPORT)
user = pwd.getpwuid(os.getuid())[0]
if user=="root" :
# Obtention du real user => signature automatique des commits
for proc in os.popen("ps a -o user,command,tty | grep $(ps h -o tty %s)" % os.getpid() ).readlines() :
userp=string.split(proc,' ')[0]
if userp=="root" : break
else : user=userp
# Obtention du real user => signature automatique des commits
ppid=os.getpid()
while user=='root' :
ppid,user = string.split(string.strip(os.popen("ps --no-headers -o ppid,user %s" % ppid).readlines()[0]))
if ppid=='1' :
# C'est init, l'user est donc bien root
break
userp='pauget'
domain = fromhost or getfqdn()
#Modif cosmétique pour afficher un sujet explicite :
host = string.split(domain,'.')