2006-12-08 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Fri, 8 Dec 2006 20:11:53 +0000 (20:11 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Fri, 8 Dec 2006 20:11:53 +0000 (20:11 -0000)
* ClientSessionCache.cs: Fix cache to be really used. Original patch
by Roy Versteeg. Fix bug #80175.

svn path=/trunk/mcs/; revision=69238

mcs/class/Mono.Security/Mono.Security.Protocol.Tls/ChangeLog
mcs/class/Mono.Security/Mono.Security.Protocol.Tls/ClientSessionCache.cs

index 1048a0fa233eaeb8a02350302361d1359192557c..2659cede686b9e4db7f95f73e0009a5017d99f50 100644 (file)
@@ -1,3 +1,8 @@
+2006-12-08  Sebastien Pouliot  <sebastien@ximian.com> 
+
+       * ClientSessionCache.cs: Fix cache to be really used. Original patch
+       by Roy Versteeg. Fix bug #80175.
+
 2006-12-08  Sebastien Pouliot  <sebastien@ximian.com>
 
        * ClientSessionCache.cs: Check for a new environment variable to 
index 8d13452c95b6664cc71d03ad5dc662d6e39376ee..749a51edea4a3094ec58e8dd19eaafac2da4eb8a 100644 (file)
@@ -191,7 +191,7 @@ namespace Mono.Security.Protocol.Tls {
                }
 
                // only called inside the lock
-               static private ClientSessionInfo FromContext (Context context)
+               static private ClientSessionInfo FromContext (Context context, bool checkValidity)
                {
                        if (context == null)
                                return null;
@@ -213,7 +213,7 @@ namespace Mono.Security.Protocol.Tls {
                                return null;
 
                        // yes, so what's its status ?
-                       if (!si.Valid) {
+                       if (checkValidity && !si.Valid) {
                                si.Dispose ();
                                cache.Remove (uid);
                                return null;
@@ -226,7 +226,9 @@ namespace Mono.Security.Protocol.Tls {
                static public bool SetContextInCache (Context context)
                {
                        lock (locker) {
-                               ClientSessionInfo csi = FromContext (context);
+                               // Don't check the validity because the masterKey of the ClientSessionInfo
+                               // can still be null when this is called the first time
+                               ClientSessionInfo csi = FromContext (context, false);
                                if (csi == null)
                                        return false;
 
@@ -239,7 +241,7 @@ namespace Mono.Security.Protocol.Tls {
                static public bool SetContextFromCache (Context context)
                {
                        lock (locker) {
-                               ClientSessionInfo csi = FromContext (context);
+                               ClientSessionInfo csi = FromContext (context, true);
                                if (csi == null)
                                        return false;