Make sure that bad sessions are removed in SSL_clear() (found by
authorLutz Jänicke <jaenicke@openssl.org>
Tue, 26 Feb 2002 21:44:07 +0000 (21:44 +0000)
committerLutz Jänicke <jaenicke@openssl.org>
Tue, 26 Feb 2002 21:44:07 +0000 (21:44 +0000)
Yoram Zahavi).
Submitted by:
Reviewed by:
PR:

CHANGES
ssl/ssl_lib.c

diff --git a/CHANGES b/CHANGES
index 03a91009d72498557f3020a4e9f6a9b1a132f8f3..9b4268795937928b0185ff3746550090e24dc9f2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
          *) applies to 0.9.6a/0.9.6b/0.9.6c and 0.9.7
          +) applies to 0.9.7 only
 
+  *) Fix bug in SSL_clear(): bad sessions were not removed (found by
+     Yoram Zahavi <YoramZ@gilian.com>).
+     [Lutz Jaenicke]
+
   +) Add and OPENSSL_LOAD_CONF define which will cause
      OpenSSL_add_all_algorithms() to load the openssl.cnf config file.
      This allows older applications to transparently support certain
index 1195171a577d7023afd8625ad2336d5a935b7497..2b60d7288feb7f0c2607ea6b68c9eeb947a5383e 100644 (file)
@@ -136,7 +136,6 @@ OPENSSL_GLOBAL SSL3_ENC_METHOD ssl3_undef_enc_method={
 
 int SSL_clear(SSL *s)
        {
-       int state;
 
        if (s->method == NULL)
                {
@@ -161,9 +160,14 @@ int SSL_clear(SSL *s)
                }
 #endif
 
-       state=s->state; /* Keep to check if we throw away the session-id */
        s->type=0;
 
+       if (ssl_clear_bad_session(s))
+               {
+               SSL_SESSION_free(s->session);
+               s->session=NULL;
+               }
+
        s->state=SSL_ST_BEFORE|((s->server)?SSL_ST_ACCEPT:SSL_ST_CONNECT);
 
        s->version=s->method->version;
@@ -182,12 +186,6 @@ int SSL_clear(SSL *s)
 
        ssl_clear_cipher_ctx(s);
 
-       if (ssl_clear_bad_session(s))
-               {
-               SSL_SESSION_free(s->session);
-               s->session=NULL;
-               }
-
        s->first_packet=0;
 
 #if 1