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