From 7c9f3999c42caca3d817a686f13e4a4cbd0a5749 Mon Sep 17 00:00:00 2001 From: pauget Date: Sun, 1 Feb 2004 13:51:27 +0100 Subject: [PATCH] Mails de CVS avec real user dans le from darcs-hash:20040201125127-41617-bddbf03f4cf8a5e873f27c342f7b9f2ac8f121cb.gz --- syncmail | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/syncmail b/syncmail index 9a3306a2..2f462507 100755 --- a/syncmail +++ b/syncmail @@ -231,14 +231,18 @@ def blast_mail(subject, people, filestodiff, contextlines, fromhost): conn = smtplib.SMTP() conn.connect(MAILHOST, MAILPORT) user = pwd.getpwuid(os.getuid())[0] - domain = fromhost or getfqdn() + + 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() #Modif cosmétique pour afficher un sujet explicite : host = string.split(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() sys.stdout = s try: