Mails de CVS avec real user dans le from

darcs-hash:20040201125127-41617-bddbf03f4cf8a5e873f27c342f7b9f2ac8f121cb.gz
This commit is contained in:
pauget 2004-02-01 13:51:27 +01:00
parent df2d6caf12
commit 7c9f3999c4

View file

@ -231,14 +231,18 @@ def blast_mail(subject, people, filestodiff, contextlines, fromhost):
conn = smtplib.SMTP() conn = smtplib.SMTP()
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
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=user
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)
#realuser=string.split(os.popen('/usr/bin/who -m').readlines()[0])[0]
#who=os.popen('/usr/bin/who -m')
#user=toto.readlines()
#print user
s = StringIO() s = StringIO()
sys.stdout = s sys.stdout = s
try: try: