diff mbox series

[1/4] python3: fix ftplib with TLS 1.3

Message ID 20180910133123.22372-1-ross.burton@intel.com
State Accepted
Commit a31047bec6b7c368674d4620e70e526ac211b936
Headers show
Series [1/4] python3: fix ftplib with TLS 1.3 | expand

Commit Message

Ross Burton Sept. 10, 2018, 1:31 p.m. UTC
With OpenSSL 1.1.x TLS 1.3 can be used, so backport a patch from Python 3.6 to
fix the ftplib unit test.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta/recipes-devtools/python/python3/ftplib.patch | 57 +++++++++++++++++++++++
 meta/recipes-devtools/python/python3_3.5.5.bb     |  1 +
 2 files changed, 58 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3/ftplib.patch

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff mbox series

Patch

diff --git a/meta/recipes-devtools/python/python3/ftplib.patch b/meta/recipes-devtools/python/python3/ftplib.patch
new file mode 100644
index 00000000000..8bb3cd02196
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/ftplib.patch
@@ -0,0 +1,57 @@ 
+From cabe916dc694997d4892b58986e73a713d5a2f8d Mon Sep 17 00:00:00 2001
+From: "Miss Islington (bot)"
+ <31488909+miss-islington@users.noreply.github.com>
+Date: Thu, 16 Aug 2018 15:38:03 -0400
+Subject: [PATCH] [3.6] bpo-34391: Fix ftplib test for TLS 1.3 (GH-8787)
+ (#8790)
+
+Read from data socket to avoid "[SSL] shutdown while in init" exception
+during shutdown of the dummy server.
+
+Signed-off-by: Christian Heimes <christian@python.org>
+
+
+<!-- issue-number: [bpo-34391](https://www.bugs.python.org/issue34391) -->
+https://bugs.python.org/issue34391
+<!-- /issue-number -->
+(cherry picked from commit 1590c393360df059160145e7475754427bfc6680)
+
+
+Co-authored-by: Christian Heimes <christian@python.org>
+---
+ Lib/test/test_ftplib.py                                         | 5 +++++
+ Misc/NEWS.d/next/Tests/2018-08-16-18-48-47.bpo-34391.ouNfxC.rst | 1 +
+ 2 files changed, 6 insertions(+)
+ create mode 100644 Misc/NEWS.d/next/Tests/2018-08-16-18-48-47.bpo-34391.ouNfxC.rst
+
+diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
+index 44dd73aeca..4ff2f71afb 100644
+--- a/Lib/test/test_ftplib.py
++++ b/Lib/test/test_ftplib.py
+@@ -876,18 +876,23 @@ class TestTLS_FTPClass(TestCase):
+         # clear text
+         with self.client.transfercmd('list') as sock:
+             self.assertNotIsInstance(sock, ssl.SSLSocket)
++            self.assertEqual(sock.recv(1024), LIST_DATA.encode('ascii'))
+         self.assertEqual(self.client.voidresp(), "226 transfer complete")
+ 
+         # secured, after PROT P
+         self.client.prot_p()
+         with self.client.transfercmd('list') as sock:
+             self.assertIsInstance(sock, ssl.SSLSocket)
++            # consume from SSL socket to finalize handshake and avoid
++            # "SSLError [SSL] shutdown while in init"
++            self.assertEqual(sock.recv(1024), LIST_DATA.encode('ascii'))
+         self.assertEqual(self.client.voidresp(), "226 transfer complete")
+ 
+         # PROT C is issued, the connection must be in cleartext again
+         self.client.prot_c()
+         with self.client.transfercmd('list') as sock:
+             self.assertNotIsInstance(sock, ssl.SSLSocket)
++            self.assertEqual(sock.recv(1024), LIST_DATA.encode('ascii'))
+         self.assertEqual(self.client.voidresp(), "226 transfer complete")
+ 
+     def test_login(self):
+-- 
+2.11.0
+
diff --git a/meta/recipes-devtools/python/python3_3.5.5.bb b/meta/recipes-devtools/python/python3_3.5.5.bb
index 40896dbc082..93878e4e45c 100644
--- a/meta/recipes-devtools/python/python3_3.5.5.bb
+++ b/meta/recipes-devtools/python/python3_3.5.5.bb
@@ -42,6 +42,7 @@  SRC_URI += "\
             file://Use-correct-CFLAGS-for-extensions-when-cross-compili.patch \
             file://0002-Makefile-add-target-to-split-profile-generation.patch \
             file://float-endian.patch \
+            file://ftplib.patch \
            "
 SRC_URI[md5sum] = "f3763edf9824d5d3a15f5f646083b6e0"
 SRC_URI[sha256sum] = "063d2c3b0402d6191b90731e0f735c64830e7522348aeb7ed382a83165d45009"