Debian Codegraph @

debian/patches/508eb4d1b8c550b5f3059ad5b33d60c6b6c76bc7.diff

raw
1 From 508eb4d1b8c550b5f3059ad5b33d60c6b6c76bc7 Mon Sep 17 00:00:00 2001
2 From: TJ Saunders <[email protected]>
3 Date: Sun, 10 May 2026 09:37:17 -0700
4 Subject: [PATCH] Issue #2056: Initial testing with OpenSSL 3.5.5 shows that
5 the prior changes for Issue #1963 were insufficient; adding a manual refcount
6 increment works.
7
8 ---
9 contrib/mod_tls.c | 18 ++++++++++++++++--
10 1 file changed, 16 insertions(+), 2 deletions(-)
11
12 diff --git a/contrib/mod_tls.c b/contrib/mod_tls.c
13 index e78e4c17b..fede5b8cd 100644
14 --- a/contrib/mod_tls.c
15 +++ b/contrib/mod_tls.c
16 @@ -9095,9 +9095,23 @@ static void tls_end_sess(SSL *ssl, conn_t *conn, int flags) {
17 */
18 pr_trace_msg(trace_channel, 29,
19 "data SSL %p being ended has same SSL_SESSION %p as control SSL, "
20 - "clearing the data SSL pointer manually (Issue #1963)", ssl,
21 + "clearing the data SSL pointer manually (see Issue #1963)", ssl,
22 SSL_get_session(ssl));
23 - SSL_set_session(ssl, NULL);
24 + if (SSL_set_session(ssl, NULL) != 1) {
25 + pr_trace_msg(trace_channel, 29,
26 + "error setting NULL session on SSL %p: %s", ssl, tls_get_errors());
27 + }
28 +
29 + /* Note that, per findings in Issue #2056, we also need to manually
30 + * increment the refcount of the ctrl_ssl session, lest we still
31 + * inadvertently corrupt the OpenSSL internal session cache state.
32 + * Sigh.
33 + */
34 + if (SSL_SESSION_up_ref(SSL_get_session(ctrl_ssl)) != 1) {
35 + pr_trace_msg(trace_channel, 29,
36 + "error incrementing session refcount on SSL %p: %s", ctrl_ssl,
37 + tls_get_errors());
38 + }
39 }
40
41 SSL_free(ssl);