aboutsummaryrefslogtreecommitdiffstats
path: root/ssl/ssl_sess.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>1999-11-17 21:36:13 +0000
committerBodo Möller <bodo@openssl.org>1999-11-17 21:36:13 +0000
commit1088e27ca823a35658a50428fef9a412face7557 (patch)
tree9d6a1fca886a755c916ea92d85da1b4c28f0fc65 /ssl/ssl_sess.c
parent4f230524924fae962aaad8fd8bf57f35a0057daa (diff)
downloadopenssl-1088e27ca823a35658a50428fef9a412face7557.tar.gz
Restore traditional SSL_get_session behaviour so that s_client and s_server
don't leak tons of memory.
Diffstat (limited to 'ssl/ssl_sess.c')
-rw-r--r--ssl/ssl_sess.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c
index 57ee7eb3c5..74ec2178a9 100644
--- a/ssl/ssl_sess.c
+++ b/ssl/ssl_sess.c
@@ -67,6 +67,18 @@ static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck);
static int ssl_session_num=0;
static STACK *ssl_session_meth=NULL;
+#if 1 /* traditional SSLeay behaviour */
+SSL_SESSION *SSL_get_session(SSL *ssl)
+ {
+ return(ssl->session);
+ }
+#else /* suggested change: increase reference counter so that a session
+ * can later be set in a new SSL object.
+ * Objections:
+ * -- the modified function should have a new name (or old
+ * applications, including s_client, leak memory);
+ * -- the locking seems unnecessary given that SSL structures
+ * usually cannot be safely shared between threads anyway. */
SSL_SESSION *SSL_get_session(SSL *ssl)
{
SSL_SESSION *sess;
@@ -80,6 +92,7 @@ SSL_SESSION *SSL_get_session(SSL *ssl)
CRYPTO_r_unlock(CRYPTO_LOCK_SSL_SESSION);
return(sess);
}
+#endif
int SSL_SESSION_get_ex_new_index(long argl, char *argp, int (*new_func)(),
int (*dup_func)(), void (*free_func)())