Fix virtual name cache initialisation. Privided by nelson. r=alexei
authoralexei.volkov.bugs%sun.com
Fri, 26 Mar 2010 20:47:57 +0000
changeset 9593 b72e73b49559867bbc06e03f58449b2f09602e36
parent 9592 f377be0d5779d2f7c9eb654d425a9ff69cb987ab
child 9594 c2288c318323a18fe6a150c339cf551d184f0e9e
push idunknown
push userunknown
push dateunknown
reviewersalexei
Fix virtual name cache initialisation. Privided by nelson. r=alexei
security/nss/lib/ssl/sslsnce.c
--- a/security/nss/lib/ssl/sslsnce.c
+++ b/security/nss/lib/ssl/sslsnce.c
@@ -1099,18 +1099,18 @@ InitCache(cacheDesc *cache, int maxCache
     cache->numSIDCacheLocks   = 
     	PR_MIN(cache->numSIDCacheSets, ssl_max_sid_cache_locks);
 
     cache->numSIDCacheSetsPerLock = 
     	SID_HOWMANY(cache->numSIDCacheSets, cache->numSIDCacheLocks);
 
     cache->numCertCacheEntries = (maxCertCacheEntries > 0) ?
                                              maxCertCacheEntries : 0;
-    cache->numSrvNameCacheEntries = (maxSrvNameCacheEntries > 0) ?
-                                             maxSrvNameCacheEntries : 0;
+    cache->numSrvNameCacheEntries = (maxSrvNameCacheEntries >= 0) ?
+                                             maxSrvNameCacheEntries : DEF_NAME_CACHE_ENTRIES;
 
     /* compute size of shared memory, and offsets of all pointers */
     ptr = 0;
     cache->cacheMem     = (char *)ptr;
     ptr += SID_ROUNDUP(sizeof(cacheDesc), SID_ALIGNMENT);
 
     cache->sidCacheLocks = (sidCacheLock *)ptr;
     cache->keyCacheLock  = cache->sidCacheLocks + cache->numSIDCacheLocks;
@@ -1163,19 +1163,16 @@ InitCache(cacheDesc *cache, int maxCache
     ptr = (ptrdiff_t)(cache->ticketMacKey + 1);
     ptr = SID_ROUNDUP(ptr, SID_ALIGNMENT);
 
     cache->ticketKeysValid = (PRUint32 *)ptr;
     ptr = (ptrdiff_t)(cache->ticketKeysValid + 1);
     ptr = SID_ROUNDUP(ptr, SID_ALIGNMENT);
 
     cache->srvNameCacheData = (srvNameCacheEntry *)ptr;
-    if (cache->numSrvNameCacheEntries < 0) {
-        cache->numSrvNameCacheEntries = DEF_NAME_CACHE_ENTRIES;
-    }
     cache->srvNameCacheSize =
         cache->numSrvNameCacheEntries * sizeof(srvNameCacheEntry);
     ptr = (ptrdiff_t)(cache->srvNameCacheData + cache->numSrvNameCacheEntries);
     ptr = SID_ROUNDUP(ptr, SID_ALIGNMENT);
 
     cache->cacheMemSize = ptr;
 
     if (ssl2_timeout) {