bugfixes fuer courier-pythonfilter
Hanno

Hanno commited on 2019-08-09 12:38:49
Zeige 3 geänderte Dateien mit 64 Einfügungen und 1 Löschungen.

... ...
@@ -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"
... ...
@@ -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
++++ b/courier/control.py	Fri Aug 09 12:31:26 2019 +0200
4
+@@ -73,7 +73,7 @@
5
+     sender = get_senders_mta(control_paths)
6
+     if not sender:
7
+         return None
8
+-    ipstr = sender.partition('[')[2].partition(']')[0]
9
++    ipstr = sender.rpartition('[')[2].partition(']')[0]
10
+     if not ipstr:
11
+         return None
12
+     sender_ip = ipaddress.ip_address(ipstr)
13
+diff -r e76f1ee05cc8 courier/xfilter.py
14
+--- a/courier/xfilter.py	Sun Apr 28 14:56:49 2019 -0700
15
++++ b/courier/xfilter.py	Fri Aug 09 12:31:26 2019 +0200
16
+@@ -26,6 +26,7 @@
17
+     import email.generator
18
+ import courier.control
19
+ import courier.config
20
++import tempfile
21
+ 
22
+ 
23
+ class XFilterError(Exception):
24
+@@ -86,18 +87,24 @@
25
+         return self.control_data
26
+ 
27
+     def submit(self):
28
+-        bfo = open(self.body_path, 'r+')
29
+-        bfo.truncate(0)
30
+-        g = email.generator.Generator(bfo, mangle_from_=False)
31
+-        g.flatten(self.message)
32
+-        # Make sure that the file ends with a newline, or courier
33
+-        # will choke on the new message file.
34
+-        bfo.seek(0, 2)
35
+-        bfo.seek(bfo.tell() - 1, 0)
36
+-        if bfo.read(1) != '\n':
37
+-            bfo.seek(0, 2)
38
+-            bfo.write('\n')
39
+-        bfo.close()
40
++        with tempfile.TemporaryFile(mode='w+b', prefix='pythonfilter') as tmp:
41
++            g = email.generator.BytesGenerator(tmp, mangle_from_=False)
42
++            g.flatten(self.message)
43
++            # Make sure that the file ends with a newline, or courier
44
++            # will choke on the new message file.
45
++            tmp.seek(0, 2)
46
++            tmp.seek(tmp.tell() - 1, 0)
47
++            if tmp.read(1).decode('ascii') != '\n':
48
++                tmp.seek(0, 2)
49
++                tmp.write('\n'.encode('ascii'))
50
++            tmp.seek(0)
51
++            with open(self.body_path, 'r+b') as bfo:
52
++                bfo.truncate(0)
53
++                while True:
54
++                    data = tmp.read(4096)
55
++                    if not data:
56
++                        break
57
++                    bfo.write(data)
58
+         return ''
59
+ 
60
+     # Deprecated names preserved for compatibility with older releases
0 61