diff options
author | Lutz Jänicke <jaenicke@openssl.org> | 2002-02-10 12:52:57 +0000 |
---|---|---|
committer | Lutz Jänicke <jaenicke@openssl.org> | 2002-02-10 12:52:57 +0000 |
commit | 76dca45720f236e6df65decefad3505bc85e1c99 (patch) | |
tree | eb1ae9e6dc97b9ba8468c5bd205be5d261821a93 /ssl | |
parent | a5f158fa0b6ae2780d63a37a4eba7a74526006c0 (diff) |
Backport from 0.9.7:
Make removal from internal session cache more robust and do not store
into internal session cache when it won't be looked up anyway.
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/ssl_lib.c | 8 | ||||
-rw-r--r-- | ssl/ssl_sess.c | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 2006a5a1eb..24cec2afe5 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -1472,9 +1472,10 @@ void ssl_update_cache(SSL *s,int mode) * and it would be rather hard to do anyway :-) */ if (s->session->session_id_length == 0) return; - if ((s->ctx->session_cache_mode & mode) - && (!s->hit) - && SSL_CTX_add_session(s->ctx,s->session) + i=s->ctx->session_cache_mode; + if ((i & mode) && (!s->hit) + && ((i & SSL_SESS_CACHE_NO_INTERNAL_LOOKUP) + || SSL_CTX_add_session(s->ctx,s->session)) && (s->ctx->new_session_cb != NULL)) { CRYPTO_add(&s->session->references,1,CRYPTO_LOCK_SSL_SESSION); @@ -1483,7 +1484,6 @@ void ssl_update_cache(SSL *s,int mode) } /* auto flush every 255 connections */ - i=s->ctx->session_cache_mode; if ((!(i & SSL_SESS_CACHE_NO_AUTO_CLEAR)) && ((i & mode) == mode)) { diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c index 7064262def..8476f41707 100644 --- a/ssl/ssl_sess.c +++ b/ssl/ssl_sess.c @@ -423,10 +423,10 @@ static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) if ((c != NULL) && (c->session_id_length != 0)) { if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); - r=(SSL_SESSION *)lh_delete(ctx->sessions,c); - if (r != NULL) + if ((r = (SSL_SESSION *)lh_retrieve(ctx->sessions,c)) == c) { ret=1; + r=(SSL_SESSION *)lh_delete(ctx->sessions,c); SSL_SESSION_list_remove(ctx,c); } |