Roundup Tracker - Issues

Issue 2551186

classification
Python versions >= 3.3 no longer use socket.sslerror
Type: crash Severity: normal
Components: Mail interface Versions: devel
process
Status: fixed fixed
:
: rouilj : kragacles, rouilj
Priority: high : patch

Created on 2022-01-04 18:15 by kragacles, last changed 2022-01-09 02:21 by rouilj.

Files
File name Uploaded Description Edit Remove
mailgw.py.patch kragacles, 2022-01-04 18:15
ssl_error-mailgw.patch.txt rouilj, 2022-01-04 23:01
Messages
msg7433 Author: [hidden] (kragacles) Date: 2022-01-04 18:15
The mailgw.py file attempts to catch the socket.sslerror, which is no longer present in 
python 3.3 and on:

https://docs.python.org/3/library/ssl.html#ssl.SSLError

As a result attempting to use mailgw.py will throw an exception:

AttributeError: module 'socket' has no attribute 'sslerror'. 

The attached simple patch fixes the issue for python3. However, this is going to end up 
skipping the error for python2.

NOTE: I had some communication around this issue in August of 2021 via email but sadly 
dropped the ball.
msg7434 Author: [hidden] (rouilj) Date: 2022-01-04 23:01
Hi Andrew,

I think I have a solution to the crash that preserves both python2 and
python3 handling of the sslerror. I have attached the patch. Do you have
an environment you can test in?

If not, do you think connecting via imaps to a non-ssl endpoint would cause the
error?

Actually I guess connecting to anything even a non-listening port should cause
the exception to be evaluated and throw a traceback right?

Thanks for bringing this to our attention and providing a patch.

-- rouilj
msg7435 Author: [hidden] (rouilj) Date: 2022-01-04 23:45
Hi Andrew:

Using nc I was able to cause an SSLError for testing.
With my patch plus adding back SSLError support for pops
both python 2 and 3, pops and imaps seem to handle the ssl
error fine.

changeset:   6582:3e8f2104753b

has the full patch and changelog.

Thanks for your report to trigger this work.

Have a great week.

-- rouilj
msg7436 Author: [hidden] (kragacles) Date: 2022-01-05 13:42
Great fix, thanks for the fast responses!

-Andrew
History
Date User Action Args
2022-01-09 02:21:15rouiljsetpriority: high
status: open -> fixed
resolution: fixed
2022-01-05 13:42:38kragaclessetmessages: + msg7436
2022-01-04 23:45:02rouiljsetmessages: + msg7435
2022-01-04 23:32:39rouiljsettitle: Python versions >= 3.3 no longer use socker.sslerror -> Python versions >= 3.3 no longer use socket.sslerror
2022-01-04 23:01:26rouiljsetstatus: new -> open
assignee: rouilj
messages: + msg7434
files: + ssl_error-mailgw.patch.txt
nosy: + rouilj
2022-01-04 18:15:12kragaclescreate