From 1f61e8f07a21e033c8fd85ff578d6354a84f2dba Mon Sep 17 00:00:00 2001 From: Todd Short Date: Thu, 26 May 2016 13:49:36 -0400 Subject: [PATCH] Always use session_ctx when removing a session Sessions are stored on the session_ctx, which doesn't change after SSL_set_SSL_CTX(). Reviewed-by: Rich Salz Reviewed-by: Matt Caswell --- ssl/d1_pkt.c | 2 +- ssl/s3_pkt.c | 4 ++-- ssl/ssl_sess.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ssl/d1_pkt.c b/ssl/d1_pkt.c index 811276b172..5fea5372f6 100644 --- a/ssl/d1_pkt.c +++ b/ssl/d1_pkt.c @@ -1251,7 +1251,7 @@ int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) BIO_snprintf(tmp, sizeof tmp, "%d", alert_descr); ERR_add_error_data(2, "SSL alert number ", tmp); s->shutdown |= SSL_RECEIVED_SHUTDOWN; - SSL_CTX_remove_session(s->ctx, s->session); + SSL_CTX_remove_session(s->session_ctx, s->session); return (0); } else { al = SSL_AD_ILLEGAL_PARAMETER; diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c index 379890237e..df124cf52c 100644 --- a/ssl/s3_pkt.c +++ b/ssl/s3_pkt.c @@ -1473,7 +1473,7 @@ int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) BIO_snprintf(tmp, sizeof tmp, "%d", alert_descr); ERR_add_error_data(2, "SSL alert number ", tmp); s->shutdown |= SSL_RECEIVED_SHUTDOWN; - SSL_CTX_remove_session(s->ctx, s->session); + SSL_CTX_remove_session(s->session_ctx, s->session); return (0); } else { al = SSL_AD_ILLEGAL_PARAMETER; @@ -1698,7 +1698,7 @@ int ssl3_send_alert(SSL *s, int level, int desc) return -1; /* If a fatal one, remove from cache */ if ((level == 2) && (s->session != NULL)) - SSL_CTX_remove_session(s->ctx, s->session); + SSL_CTX_remove_session(s->session_ctx, s->session); s->s3->alert_dispatch = 1; s->s3->send_alert[0] = level; diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c index 1dd6e6b142..ed9855f90c 100644 --- a/ssl/ssl_sess.c +++ b/ssl/ssl_sess.c @@ -1127,7 +1127,7 @@ int ssl_clear_bad_session(SSL *s) if ((s->session != NULL) && !(s->shutdown & SSL_SENT_SHUTDOWN) && !(SSL_in_init(s) || SSL_in_before(s))) { - SSL_CTX_remove_session(s->ctx, s->session); + SSL_CTX_remove_session(s->session_ctx, s->session); return (1); } else return (0); -- 2.25.1