Skip to content

Commit 86b04ff

Browse files
committed
Refactor setting OCSP defaults
Expected defaults were not applied if a SSL_CONF_CTX was not used
1 parent 829b98b commit 86b04ff

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

native/src/sslconf.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,6 @@ TCN_IMPLEMENT_CALL(jlong, SSLConf, make)(TCN_STDARGS, jlong pool,
113113
c->cctx = cctx;
114114
c->pool = p;
115115

116-
/* OCSP defaults */
117-
c->no_ocsp_check = OCSP_NO_CHECK_DEFAULT;
118-
c->ocsp_soft_fail = OCSP_SOFT_FAIL_DEFAULT;
119-
c->ocsp_timeout = OCSP_TIMEOUT_DEFAULT;
120-
c->ocsp_verify_flags = OCSP_VERIFY_FLAGS_DEFAULT;
121-
122116
/*
123117
* Let us cleanup the SSL_CONF context when the pool is destroyed
124118
*/

native/src/sslcontext.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,12 @@ TCN_IMPLEMENT_CALL(jlong, SSLContext, make)(TCN_STDARGS, jlong pool,
414414
stringClass = (jclass) (*e)->NewGlobalRef(e, sClazz);
415415
}
416416

417+
/* Configure OCSP defaults here in case there is no SSL_CONF_CTX used. */
418+
c->no_ocsp_check = OCSP_NO_CHECK_DEFAULT;
419+
c->ocsp_soft_fail = OCSP_SOFT_FAIL_DEFAULT;
420+
c->ocsp_timeout = OCSP_TIMEOUT_DEFAULT;
421+
c->ocsp_verify_flags = OCSP_VERIFY_FLAGS_DEFAULT;
422+
417423
return P2J(c);
418424
init_failed:
419425
return 0;

xdocs/miscellaneous/changelog.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@
5050
Fix a potential memory leak if an invalid <code>OpenSSLConf</code> is
5151
provided. Pull request <pr>36</pr> provided by chenjp. (markt)
5252
</fix>
53+
<fix>
54+
Refactor setting of OCSP configuration defaults as they were only applied
55+
if the SSL_CONF_CTX was used. While one was always used wth Tomcat
56+
versions aware of the OCSP configuration options, one was not always used
57+
with Tomcat versions unaware of the OCSP configuration options leading to
58+
OCSP verification being enabled by default when the expected behaviour was
59+
disabled by default. (markt)
60+
</fix>
5361
</changelog>
5462
</section>
5563
<section name="2.0.12" rtext="2026-01-12">

0 commit comments

Comments
 (0)