summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e97aac1)
raw | patch | inline | side by side (parent: e97aac1)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 10 Dec 2002 00:23:36 +0000 (00:23 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 10 Dec 2002 00:23:36 +0000 (00:23 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1395 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/mailgw.py | patch | blob | history | |
roundup/roundupdb.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index 6f7e5db8466745bb94d6bd2fea82a47382530bcd..3e0552d56595b4711e8d84f031bc10b153b1821f 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
- removed FILTER_POSITION from bundled configs
- reverse message listing in issue display (reversion of recent change)
- bad entries for multilink editing in cgi don't traceback now (sf bug 640310)
+- detect and break email loops (sf bug 640854)
2002-11-07 0.5.2
diff --git a/roundup/mailgw.py b/roundup/mailgw.py
index 3f62e415520b3f5a44d69007cd398380a15e51a0..b7b29a6e455af90a003cbec69cff352b0461f721 100644 (file)
--- a/roundup/mailgw.py
+++ b/roundup/mailgw.py
an exception, the original message is bounced back to the sender with the
explanatory message given in the exception.
-$Id: mailgw.py,v 1.100 2002-12-10 00:11:15 richard Exp $
+$Id: mailgw.py,v 1.101 2002-12-10 00:23:35 richard Exp $
'''
import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
class MailUsageHelp(Exception):
pass
+class MailLoop(Exception):
+ ''' We've seen this message before... '''
+ pass
+
class Unauthorized(Exception):
""" Access denied """
m = ['']
m.append(str(value))
m = self.bounce_message(message, sendto, m)
+ except MailLoop:
+ # XXX we should use a log file here...
+ return
except:
# bounce the message back to the sender with the error message
+ # XXX we should use a log file here...
sendto = [sendto[0][1], self.instance.config.ADMIN_EMAIL]
m = ['']
m.append('An unexpected error occurred during the processing')
m = self.bounce_message(message, sendto, m)
else:
# very bad-looking message - we don't even know who sent it
+ # XXX we should use a log file here...
sendto = [self.instance.config.ADMIN_EMAIL]
m = ['Subject: badly formed message from mail gateway']
m.append('')
'''
msg = cStringIO.StringIO()
writer = MimeWriter.MimeWriter(msg)
+ writer.addheader('X-Roundup-Loop', 'hello')
writer.addheader('Subject', subject)
writer.addheader('From', '%s <%s>'% (self.instance.config.TRACKER_NAME,
self.instance.config.TRACKER_EMAIL))
Parse the message as per the module docstring.
'''
+ # detect loops
+ if message.getheader('x-roundup-loop', ''):
+ raise MailLoop
+
# handle the subject line
subject = message.getheader('subject', '')
diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py
index 8fd9b287bf552ad1920678dca470a16adfc62d94..af624eba974697dfd9fd599eee7b98a0cc0ffb8e 100644 (file)
--- a/roundup/roundupdb.py
+++ b/roundup/roundupdb.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: roundupdb.py,v 1.73 2002-11-05 22:59:46 richard Exp $
+# $Id: roundupdb.py,v 1.74 2002-12-10 00:23:36 richard Exp $
__doc__ = """
Extending hyperdb with types specific to issue-tracking.
# add a uniquely Roundup header to help filtering
writer.addheader('X-Roundup-Name', self.db.config.TRACKER_NAME)
+ # avoid email loops
+ writer.addheader('X-Roundup-Loop', 'hello')
+
# attach files
if message_files:
part = writer.startmultipartbody('mixed')