From 6fd862abc9e8711bd4aa117697c5df85cf6f560a Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Wed, 28 Oct 2015 18:52:34 +0100 Subject: [feat] add '@deliver.local' to uuid - Resolves: #5959 --- changes/next-changelog.txt | 29 +++++++++++++++++++++++++++++ src/leap/mx/alias_resolver.py | 3 ++- src/leap/mx/mail_receiver.py | 4 ++-- src/leap/mx/tests/test_mail_receiver.py | 7 ++++--- 4 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 changes/next-changelog.txt diff --git a/changes/next-changelog.txt b/changes/next-changelog.txt new file mode 100644 index 0000000..c7ba3b8 --- /dev/null +++ b/changes/next-changelog.txt @@ -0,0 +1,29 @@ +0.8.0 - xxx ++++++++++++++++++++++++++++++++ + +Please add lines to this file, they will be moved to the CHANGELOG.rst during +the next release. + +There are two template lines for each category, use them as reference. + +I've added a new category `Misc` so we can track doc/style/packaging stuff. + +Features +~~~~~~~~ +- `#5959 `_: Make alias resolver to return *uuid@deliver.local* +- `#1234 `_: Description of the new feature corresponding with issue #1234. +- New feature without related issue number. + +Bugfixes +~~~~~~~~ +- `#1235 `_: Description for the fixed stuff corresponding with issue #1235. +- Bugfix without related issue number. + +Misc +~~~~ +- `#1236 `_: Description of the new feature corresponding with issue #1236. +- Some change without issue number. + +Known Issues +~~~~~~~~~~~~ +- `#1236 `_: Description of the known issue corresponding with issue #1236. diff --git a/src/leap/mx/alias_resolver.py b/src/leap/mx/alias_resolver.py index bf7a58b..a5b5107 100644 --- a/src/leap/mx/alias_resolver.py +++ b/src/leap/mx/alias_resolver.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- encoding: utf-8 -*- # alias_resolver.py -# Copyright (C) 2013 LEAP +# Copyright (C) 2013, 2015 LEAP # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -60,6 +60,7 @@ class LEAPPostfixTCPMapAliasServer(postfix.PostfixTCPMapServer): TCP_MAP_CODE_PERMANENT_FAILURE, postfix.quote("NOT FOUND SRY")) else: + uuid += "@deliver.local" # properly encode uuid, otherwise twisted complains when replying if isinstance(uuid, unicode): uuid = uuid.encode("utf8") diff --git a/src/leap/mx/mail_receiver.py b/src/leap/mx/mail_receiver.py index a9344c3..ea13658 100644 --- a/src/leap/mx/mail_receiver.py +++ b/src/leap/mx/mail_receiver.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- encoding: utf-8 -*- # mail_receiver.py -# Copyright (C) 2013 LEAP +# Copyright (C) 2013, 2015 LEAP # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -269,7 +269,7 @@ class MailReceiver(Service): return None final_address = delivereds.pop(0) _, addr = email.utils.parseaddr(final_address) - uuid, _ = addr.split("@") + uuid = addr.split("@")[0] return uuid @defer.inlineCallbacks diff --git a/src/leap/mx/tests/test_mail_receiver.py b/src/leap/mx/tests/test_mail_receiver.py index 3eeafbd..e72cb1a 100644 --- a/src/leap/mx/tests/test_mail_receiver.py +++ b/src/leap/mx/tests/test_mail_receiver.py @@ -37,6 +37,7 @@ from leap.mx.mail_receiver import MailReceiver BOUNCE_ADDRESS = "bounce@leap.se" BOUNCE_SUBJECT = "bounce subject" ADDRESS = "leap@leap.se" +UUID = "13d5203bdd09be1e638bdb1d315251cb" class MailReceiverTestCase(unittest.TestCase): @@ -78,8 +79,7 @@ class MailReceiverTestCase(unittest.TestCase): def test_single_mail(self): msg, path = self.addMail("foo bar") uuid, doc = yield self.defer_put_doc - orig_uuid = ADDRESS.split('@')[0] - self.assertEqual(uuid, orig_uuid) + self.assertEqual(uuid, UUID) decmsg = self.decryptDoc(doc) self.assertEqual(msg, decmsg) self.assertFalse(os.path.exists(path)) @@ -101,7 +101,8 @@ class MailReceiverTestCase(unittest.TestCase): frm="someone@domain.org", subject="sent subject"): msg = Message() msg.add_header("To", to) - msg.add_header("Delivered-To", to) + msg.add_header( + "Delivered-To", UUID + "@deliver.local") msg.add_header("From", frm) msg.add_header("Subject", subject) msg.set_payload(body) -- cgit v1.2.3