Skip to content

Commit

Permalink
bpo-43789: OpenSSL 3.0.0 Don't call passwd callback again in error ca…
Browse files Browse the repository at this point in the history
  • Loading branch information
tiran authored Apr 9, 2021
1 parent bd88ccb commit d3b73f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
OpenSSL 3.0.0: Don't call the password callback function a second time when
first call has signaled an error condition.
7 changes: 7 additions & 0 deletions Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -3926,6 +3926,13 @@ _password_callback(char *buf, int size, int rwflag, void *userdata)

PySSL_END_ALLOW_THREADS_S(pw_info->thread_state);

if (pw_info->error) {
/* already failed previously. OpenSSL 3.0.0-alpha14 invokes the
* callback multiple times which can lead to fatal Python error in
* exception check. */
goto error;
}

if (pw_info->callable) {
fn_ret = _PyObject_CallNoArg(pw_info->callable);
if (!fn_ret) {
Expand Down

0 comments on commit d3b73f3

Please sign in to comment.