I see that there are at least two bugs (534 & 569) in the database that
are crashes in ap_ctx. After some analysis, it turned out that the
reason was that the 'request_rec' structure had been freed and then was
being dereferenced (this is because the life of a request is shorter
than an SSL connection).
Anyway, the attached patch (which can be applied to the pkg.sslmod
directory) fixes the problem for me. Basically it associates the 'suck'
buffer with the input buffer, and not with the request -- the input
buffer has a much longer lifetime than the request.
Enjoy
Philip
Index: ssl_engine_io.c
===================================================================
RCS file:
Z:\cvsroot/thirdparty/apache/mod_ssl-2.8.4-1.3.20/pkg.sslmod/ssl_engine_io.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ssl_engine_io.c 2001/06/05 18:45:07 1.1
+++ ssl_engine_io.c 2001/08/14 22:01:51 1.2
@@ -253,16 +253,16 @@
{
ap_ctx *actx;
struct ssl_io_suck_st *ss;
- request_rec *r = NULL;
+ BUFF *b = NULL;
int rv;
actx = (ap_ctx *)SSL_get_app_data2(ssl);
if (actx != NULL)
- r = (request_rec *)ap_ctx_get(actx, "ssl::request_rec");
+ b = (BUFF *)ap_ctx_get(actx, "ssl::client_buff");
rv = -1;
- if (r != NULL) {
- ss = ap_ctx_get(r->ctx, "ssl::io::suck");
+ if (b != NULL) {
+ ss = ap_ctx_get(b->ctx, "ssl::io::suck");
if (ss != NULL) {
if (ss->active && ss->pendlen > 0) {
/* ok, there is pre-sucked data */
@@ -270,9 +270,11 @@
memcpy(buf, ss->pendptr, len);
ss->pendptr += len;
ss->pendlen -= len;
+ /*
ssl_log(r->server, SSL_LOG_TRACE,
"I/O: injecting %d bytes of pre-sucked data "
"into Apache I/O layer", len);
+ */
rv = len;
}
}
Index: ssl_engine_kernel.c
===================================================================
RCS file:
Z:\cvsroot/thirdparty/apache/mod_ssl-2.8.4-1.3.20/pkg.sslmod/ssl_engine_kernel.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ssl_engine_kernel.c 2001/06/05 18:45:07 1.1
+++ ssl_engine_kernel.c 2001/08/14 22:02:08 1.2
@@ -196,7 +196,7 @@
}
SSL_set_app_data(ssl, conn);
apctx = ap_ctx_new(conn->pool);
- ap_ctx_set(apctx, "ssl::request_rec", NULL);
+ ap_ctx_set(apctx, "ssl::client_buff", NULL); /* Why do we do this? */
ap_ctx_set(apctx, "ssl::verify::depth", AP_CTX_NUM2PTR(0));
SSL_set_app_data2(ssl, apctx);
SSL_set_fd(ssl, fb->fd);
@@ -534,6 +534,7 @@
ssl = ap_ctx_get(r->connection->client->ctx, "ssl");
if (ssl != NULL) {
apctx = SSL_get_app_data2(ssl);
+ ap_ctx_set(apctx, "ssl::client_buff", r->connection->client);
ap_ctx_set(apctx, "ssl::request_rec", r);
}
S/MIME Cryptographic Signature