Bug 397486 - Client session cache lock not freed on strsclnt shutdown.

r=alexei.volkov


git-svn-id: svn://10.0.0.236/trunk@245744 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
nelson%bolyard.com
2008-02-15 00:01:48 +00:00
parent 29b0d11dea
commit d20528eb85
2 changed files with 28 additions and 6 deletions

View File

@@ -36,12 +36,13 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* $Id: sslnonce.c,v 1.17 2005-09-09 03:02:16 nelsonb%netscape.com Exp $ */
/* $Id: sslnonce.c,v 1.18 2008-02-14 23:58:27 nelson%bolyard.com Exp $ */
#include "nssrenam.h"
#include "cert.h"
#include "secitem.h"
#include "ssl.h"
#include "nss.h" /* for NSS_RegisterShutdown */
#include "sslimpl.h"
#include "sslproto.h"
@@ -68,10 +69,34 @@ static PZLock * cacheLock = NULL;
#define LOCK_CACHE lock_cache()
#define UNLOCK_CACHE PZ_Unlock(cacheLock)
static const PRCallOnceType pristineCallOnce;
static PRCallOnceType setupClientCacheLockOnce;
static SECStatus clientCacheLockShutdown(void* appData, void* nssData)
{
if (cacheLock) {
PZ_DestroyLock(cacheLock);
cacheLock = NULL;
}
setupClientCacheLockOnce = pristineCallOnce;
return SECSuccess;
}
static PRStatus clientCacheLockSetup(void)
{
SECStatus rv = NSS_RegisterShutdown(clientCacheLockShutdown, NULL);
PORT_Assert(SECSuccess == rv);
if (SECSuccess == rv) {
nss_InitLock(&cacheLock, nssILockCache);
return PR_SUCCESS;
}
return PR_FAILURE;
}
void ssl_InitClientSessionCacheLock(void)
{
if (!cacheLock)
nss_InitLock(&cacheLock, nssILockCache);
PR_CallOnce(&setupClientCacheLockOnce, &clientCacheLockSetup);
}
static void
@@ -359,7 +384,7 @@ ssl_Time(void)
{
PRUint32 myTime;
#if (defined(XP_UNIX) || defined(XP_WIN) || defined(_WINDOWS) || defined(XP_BEOS)) && !defined(_WIN32_WCE)
myTime = time(NULL); /* accurate until the year 2038. */
myTime = (PRUint32)time(NULL); /* accurate until the year 2038. */
#else
/* portable, but possibly slower */
PRTime now;

View File

@@ -26,9 +26,6 @@
#393181
ocspclnt/main/CERT_SetOCSPDefaultResponder/**
#397478
selfserv/main/SSL_ConfigServerSessionIDCache/**
#397483
**/PR_CallOnce/InitializeArenas/PR_NewLock/**