dummysmtpd: fix EOF handling on newer versions of OpenSSL
Explanations inline.
--- a/tests/dummysmtpd.py Mon Jul 22 14:19:12 2024 +0200
+++ b/tests/dummysmtpd.py Mon Jul 22 14:42:54 2024 +0200
@@ -31,8 +31,15 @@
def mocksmtpserversession(conn, addr):
conn.send(b'220 smtp.example.com ESMTP\r\n')
- line = conn.recv(1024)
+ try:
+ # Newer versions of OpenSSL raise on EOF
+ line = conn.recv(1024)
+ except ssl.SSLError:
+ log('no hello: EOF\n')
+ return
+
if not line.lower().startswith(b'ehlo '):
+ # Older versions of OpenSSl don't raise
log('no hello: %s\n' % line)
return
--- a/tests/test-patchbomb-tls.t Mon Jul 22 14:19:12 2024 +0200
+++ b/tests/test-patchbomb-tls.t Mon Jul 22 14:42:54 2024 +0200
@@ -98,7 +98,7 @@
$ wait_log "no hello:"
$ cat ../log
connection from * (glob)
- no hello: b''
+ no hello: (b''|EOF) (re)
$ : > ../log
With global certificates: