Skip to content

Commit d3b73f3

Browse files
authored
bpo-43789: OpenSSL 3.0.0 Don't call passwd callback again in error case (GH-25303)
1 parent bd88ccb commit d3b73f3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
OpenSSL 3.0.0: Don't call the password callback function a second time when
2+
first call has signaled an error condition.

Modules/_ssl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3926,6 +3926,13 @@ _password_callback(char *buf, int size, int rwflag, void *userdata)
39263926

39273927
PySSL_END_ALLOW_THREADS_S(pw_info->thread_state);
39283928

3929+
if (pw_info->error) {
3930+
/* already failed previously. OpenSSL 3.0.0-alpha14 invokes the
3931+
* callback multiple times which can lead to fatal Python error in
3932+
* exception check. */
3933+
goto error;
3934+
}
3935+
39293936
if (pw_info->callable) {
39303937
fn_ret = _PyObject_CallNoArg(pw_info->callable);
39313938
if (!fn_ret) {

0 commit comments

Comments
 (0)