Blame 009-raise-an-error-when-STARTTLS-fails.patch

343676a
From 4c0f6a6fe6c71009ab4a6b3716e70af021e04904 Mon Sep 17 00:00:00 2001
092bdc1
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
343676a
Date: Sat, 2 Jul 2016 20:18:12 +0200
092bdc1
Subject: [PATCH] Raise an error when STARTTLS fails
092bdc1
092bdc1
CVE-2016-0772 python: smtplib StartTLS stripping attack
092bdc1
rhbz#1303647: https://bugzilla.redhat.com/show_bug.cgi?id=1303647
092bdc1
rhbz#1351680: https://bugzilla.redhat.com/show_bug.cgi?id=1351680
092bdc1
092bdc1
Based on an upstream change by Benjamin Peterson <benjamin@python.org>
092bdc1
- in changeset 101887:d590114c2394 3.4
092bdc1
- https://hg.python.org/cpython/rev/d590114c2394
092bdc1
---
092bdc1
 lib-python/3/smtplib.py | 5 +++++
092bdc1
 1 file changed, 5 insertions(+)
092bdc1
092bdc1
diff --git a/lib-python/3/smtplib.py b/lib-python/3/smtplib.py
343676a
index 57f181b..5656cc6 100755
092bdc1
--- a/lib-python/3/smtplib.py
092bdc1
+++ b/lib-python/3/smtplib.py
343676a
@@ -680,6 +680,11 @@ class SMTP:
092bdc1
             self.ehlo_resp = None
092bdc1
             self.esmtp_features = {}
092bdc1
             self.does_esmtp = 0
092bdc1
+        else:
092bdc1
+            # RFC 3207:
092bdc1
+            # 501 Syntax error (no parameters allowed)
092bdc1
+            # 454 TLS not available due to temporary reason
092bdc1
+            raise SMTPResponseException(resp, reply)
092bdc1
         return (resp, reply)
092bdc1
 
092bdc1
     def sendmail(self, from_addr, to_addrs, msg, mail_options=[],
092bdc1
-- 
092bdc1
2.9.0
092bdc1