From f6d618d52fbe1345b2780ea0e53b39305a470841 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 06 2016 09:56:16 +0000 Subject: Let the milter support the reply address to be in the To or the Cc field --- diff --git a/milters/comment_email_milter.py b/milters/comment_email_milter.py index 83c4026..221c5e4 100644 --- a/milters/comment_email_milter.py +++ b/milters/comment_email_milter.py @@ -125,13 +125,17 @@ class PagureMilter(Milter.Base): self.log('msg-ig %s' % msg_id) self.log('To %s' % msg['to']) + self.log('Cc %s' % msg.get('cc')) self.log('From %s' % msg['From']) # Ensure the user replied to his/her own notification, not that # they are trying to forge their ID into someone else's salt = pagure.APP.config.get('SALT_EMAIL') m = hashlib.sha512('%s%s%s' % (msg_id, salt, clean_item(msg['From']))) - tohash= msg['to'].split('@')[0].split('+')[-1] + email = msg['to'] + if 'reply+' in msg.get('cc'): + email = msg['cc'] + tohash= email.split('@')[0].split('+')[-1] if m.hexdigest() != tohash: self.log('hash: %s' % m.hexdigest()) self.log('tohash: %s' % tohash)