Browse code

bugfixes fuer courier-pythonfilter

Hanno authored on09/08/2019 12:38:49
Showing3 changed files
... ...
@@ -1,6 +1,7 @@
1
+AUX courier-pythonfilter-fix-charset-issue-and-controlfile-issue.diff 2175 BLAKE2B e69f1bd4c4d7567d7ded99685d2b1aa177cbf5a7c5d9aed35dd1ff5c297cbb0c14c7bbbfcf25b0c2a284a0eba48583ee28057948fdec2d830293ed18d73d6494 SHA512 5efaea5188f5e97b3343c1e2b2dc99ef23e61f29aa7ca150144e9aa16e49b2c2790aadff877a46fcd37fcfce68bd26d2c9a38f984f1283b62a3ddb382d816b65
1 2
 AUX courier-pythonfilter-ipv6-networkblocks.patch 1257 BLAKE2B 4f1a59347a34676d996f8ecc1bbc7c15296d86466dd236cc638ea0ec87fffaa4faef2b57fbd55bc6714d21b81911a3cf62ce2387b719d7bbdf01021ccceff55e SHA512 29c80a3f247259d35076c985a54e9e053b61867da12849fa1bffc98ba45e9d56cd3afda9d61c9b65e2cfc9897e313d2ce40e14b71157aa5df03d58728ce92c37
2 3
 AUX courier-pythonfilter-whitelist-sender.patch 2205 BLAKE2B f136fb9d5fef6ccf70edea0c36e324060778c5adcd9621b4955dde5563e3d55d7c733743df0ebd59ef700961acdfcbd97f9d3fe2330076406bb07e0a8f0f0055 SHA512 9a25b079ed7b7680ba59809a1cf600c53b0ca688f138e01255e8d47ba34d144996381ac38d5a0ce93986c73e0c59adf59661d8824c190371744c789b4a667d75
3 4
 DIST courier-pythonfilter-1.11.tar.gz 65193 BLAKE2B 9b14e8caa6f173abb15c74c43854c917c61731e0610a9acd4f4e8300043663dca6f00e99f9c7eed7296bb07a37726457a6aaa182981e522632057ffc70250bbf SHA512 75ffff7d9692861c535ee18d1d25954c79e81275641172ad706caf0c65dc715ffd4a1c021b0e26fc992fffdf6c2842ed8fc688eff82ec42591b35af834c0ace4
4 5
 DIST courier-pythonfilter-3.0.tar.gz 59420 BLAKE2B 61ab15a0ee55a0cba5bde632cb28a0f17e4b0285e0a7060e5771b5ea2ecde8bc1306cc2b1c0b3833e521a8ca5a899ae9f56fdb26f89c76d38e0ce25ea75e8f04 SHA512 6c13c65111ac6ab86d93d3ccfa27208c963dbf4fd67b86d3948fa1935c131fd2ca5944cb4163ecf71355760ccb478faf59974ee0573b9e74bc163f633333c5c0
5 6
 EBUILD courier-pythonfilter-1.11.ebuild 626 BLAKE2B 92901ce0f943e1e9036dd859e8b5a376f625315ac10df504faaf967419e81234e820fa15156f645b2fe01f49affded41af9a48861eb95c18e2db6546c293a815 SHA512 19eb0bd699ebb65a0a2a451742d7ca5331f2c830877dece69314103f7b7636fa1f066860daf596b711377e749a317ad4ceed8496287fac16a4eaade74d6cd831
6
-EBUILD courier-pythonfilter-3.0.ebuild 479 BLAKE2B b4069eed43261429aeffbbe345c1fdee1d5c1d67b8e45fce6c55eeffef2c86c5f16ed44c812ff396f66d430886013918a56a29b77ba8c5e08c5326a94a9b61fb SHA512 60e220f416e978e377c64a6744ad4c64b228b555661bc758691cc84cb7043dbe9e27bb91492f70c1e5bf713fb2a5a47b57796c999218514b2c7515a03a8ee85b
7
+EBUILD courier-pythonfilter-3.0.ebuild 568 BLAKE2B 43d07c8b880429e9f971fbc7727ddc1781b325ba0d58987d6b2a9444a19aa78fe605bb3ca55b076ed65ba6cc8a67725735c6e1b7c03f9397b3ebf41210472fe7 SHA512 3654aea2cad4ec8a97fcae8b7b7a92194da63e1046bc5c3f028f0aea15103a0ef39bdf3674619a8271a2133196a486133b60b9bc125167f6b51e65dd2e7e4a17
... ...
@@ -19,3 +19,5 @@ IUSE=""
19 19
 RDEPEND=""
20 20
 DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
21 21
 	mail-mta/courier"
22
+
23
+PATCHES="${FILESDIR}/courier-pythonfilter-fix-charset-issue-and-controlfile-issue.diff"
22 24
new file mode 100644
... ...
@@ -0,0 +1,60 @@
1
+diff -r e76f1ee05cc8 courier/control.py
2
+--- a/courier/control.py	Sun Apr 28 14:56:49 2019 -0700
3
+@@ -73,7 +73,7 @@
4
+     sender = get_senders_mta(control_paths)
5
+     if not sender:
6
+         return None
7
+-    ipstr = sender.partition('[')[2].partition(']')[0]
8
++    ipstr = sender.rpartition('[')[2].partition(']')[0]
9
+     if not ipstr:
10
+         return None
11
+     sender_ip = ipaddress.ip_address(ipstr)
12
+diff -r e76f1ee05cc8 courier/xfilter.py
13
+--- a/courier/xfilter.py	Sun Apr 28 14:56:49 2019 -0700
14
+@@ -26,6 +26,7 @@
15
+     import email.generator
16
+ import courier.control
17
+ import courier.config
18
++import tempfile
19
+ 
20
+ 
21
+ class XFilterError(Exception):
22
+@@ -86,18 +87,24 @@
23
+         return self.control_data
24
+ 
25
+     def submit(self):
26
+-        bfo = open(self.body_path, 'r+')
27
+-        bfo.truncate(0)
28
+-        g = email.generator.Generator(bfo, mangle_from_=False)
29
+-        g.flatten(self.message)
30
+-        # Make sure that the file ends with a newline, or courier
31
+-        # will choke on the new message file.
32
+-        bfo.seek(0, 2)
33
+-        bfo.seek(bfo.tell() - 1, 0)
34
+-        if bfo.read(1) != '\n':
35
+-            bfo.seek(0, 2)
36
+-            bfo.write('\n')
37
+-        bfo.close()
38
++        with tempfile.TemporaryFile(mode='w+b', prefix='pythonfilter') as tmp:
39
++            g = email.generator.BytesGenerator(tmp, mangle_from_=False)
40
++            g.flatten(self.message)
41
++            # Make sure that the file ends with a newline, or courier
42
++            # will choke on the new message file.
43
++            tmp.seek(0, 2)
44
++            tmp.seek(tmp.tell() - 1, 0)
45
++            if tmp.read(1).decode('ascii') != '\n':
46
++                tmp.seek(0, 2)
47
++                tmp.write('\n'.encode('ascii'))
48
++            tmp.seek(0)
49
++            with open(self.body_path, 'r+b') as bfo:
50
++                bfo.truncate(0)
51
++                while True:
52
++                    data = tmp.read(4096)
53
++                    if not data:
54
++                        break
55
++                    bfo.write(data)
56
+         return ''
57
+ 
58
+     # Deprecated names preserved for compatibility with older releases