shutdown() can raise an "empty" exception
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pyOpenSSL |
Incomplete
|
Undecided
|
Giampaolo Rodolà |
Bug Description
Where by "empty" I mean:
ipdb> err
Error([],)
ipdb> err.args
([],)
ipdb> err.message
[]
This comes from a user who reported a bug on pyftpdlib issue tracker:
http://
The problem appears to be here:
MY_
ret = SSL_shutdown(
MY_
if (PyErr_Occurred())
{
return NULL;
}
The right way to handle this, IMO, would be to avoid calling PyErr_Occurred() / flush_error_queue() at all and check SSL_shutdown return code and then call SSL_get_error() instead.
If SSL_get_error() returns SSL_ERROR_NONE (as in this case) it would make sense to just return Py_False.
For the upper application this means that Connection.
From discussion on IRC, this is probably because of the handling of `ret < 0` case. SSL_shutdown doesn't seem to push any errors into the queue, instead you're supposed to interpret the return value as an error code.