La bonne ?
darcs-hash:20040214193939-41617-d7889dd5e7765142b901c0d20a715d790d1bab8e.gz
This commit is contained in:
parent
86b10a19ab
commit
faf90b89ed
1 changed files with 8 additions and 12 deletions
20
syncmail
20
syncmail
|
@ -232,22 +232,18 @@ 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]
|
||||||
|
|
||||||
# Obtention du real user => signature automatique des commits
|
if user=="root" :
|
||||||
ppid=os.getpid()
|
# Obtention du real user => signature automatique des commits
|
||||||
print ppid
|
for proc in os.popen("ps --no-headers -o user -t $(ps --no-headers -o tty %s)" % os.getpid() ).readlines() :
|
||||||
os.system("ps a -o tty,ppid,pid %s" % ppid)
|
userp=string.strip(proc)
|
||||||
while user=='root' :
|
if userp=="root" : break
|
||||||
ppid,user = string.split(string.strip(os.popen("ps --no-headers -o ppid,user %s" % ppid).readlines()[0]))
|
else : user=userp
|
||||||
if ppid=='1' :
|
|
||||||
# C'est init, l'user est donc bien root
|
|
||||||
break
|
|
||||||
|
|
||||||
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,'.')
|
||||||
author = '%s@%s' % (user, domain)
|
author = '%s@%s' % (user, domain)
|
||||||
people = 'fred@crans.org'
|
s = StringIO()
|
||||||
s = StringIO()
|
|
||||||
sys.stdout = s
|
sys.stdout = s
|
||||||
try:
|
try:
|
||||||
print '''\
|
print '''\
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue