Mercurial > p > roundup > code
diff roundup/mailgw.py @ 5045:a46d5d0fd5f8
Fix issue1615201: Added a new configuration option EMAIL_KEEP_REAL_FROM
which makes the mail gateway ignore a Resent-From:-header and use the
real From:-header of the original author for further processing of the
message. Setting this option to 'yes' restores the original behaviour
of Roundup before the change in version 0.7.0 where the processing of
Resent-From: was added unconditionally.
| author | Peter Funk <pf@artcom-gmbh.de> |
|---|---|
| date | Fri, 18 Mar 2016 16:18:20 +0100 |
| parents | 7f8f27ce1a06 |
| children | d995ee7d49bf |
line wrap: on
line diff
--- a/roundup/mailgw.py Wed Feb 11 00:44:16 2015 +1100 +++ b/roundup/mailgw.py Fri Mar 18 16:18:20 2016 +0100 @@ -540,8 +540,12 @@ self.has_prefix = False self.matches = dict.fromkeys(['refwd', 'quote', 'classname', 'nodeid', 'title', 'args', 'argswhole']) - self.from_list = message.getaddrlist('resent-from') \ - or message.getaddrlist('from') + self.keep_real_from = self.config['EMAIL_KEEP_REAL_FROM'] + if self.keep_real_from: + self.from_list = message.getaddrlist('from') + else: + self.from_list = message.getaddrlist('resent-from') \ + or message.getaddrlist('from') self.pfxmode = self.config['MAILGW_SUBJECT_PREFIX_PARSING'] self.sfxmode = self.config['MAILGW_SUBJECT_SUFFIX_PARSING'] # these are filled in by subsequent parsing steps @@ -1469,7 +1473,7 @@ self.parsed_message = None crypt = False sendto = message.getaddrlist('resent-from') - if not sendto: + if not sendto or self.instance.config['EMAIL_KEEP_REAL_FROM']: sendto = message.getaddrlist('from') if not sendto: # very bad-looking message - we don't even know who sent it
