diff --git a/security/nss/lib/base/base.h b/security/nss/lib/base/base.h index 0970c3fed49..f57710b6975 100644 --- a/security/nss/lib/base/base.h +++ b/security/nss/lib/base/base.h @@ -35,7 +35,7 @@ #define BASE_H #ifdef DEBUG -static const char BASE_CVS_ID[] = "@(#) $RCSfile: base.h,v $ $Revision: 1.10 $ $Date: 2001-11-28 16:23:34 $ $Name: $"; +static const char BASE_CVS_ID[] = "@(#) $RCSfile: base.h,v $ $Revision: 1.11 $ $Date: 2001-12-12 20:23:05 $ $Name: $"; #endif /* DEBUG */ /* @@ -1055,6 +1055,9 @@ nssHash_Destroy * nssHash_Add * */ + +extern const NSSError NSS_ERROR_HASH_COLLISION; + NSS_EXTERN PRStatus nssHash_Add ( diff --git a/security/nss/lib/base/errorval.c b/security/nss/lib/base/errorval.c index b243b04fdf8..816d8506429 100644 --- a/security/nss/lib/base/errorval.c +++ b/security/nss/lib/base/errorval.c @@ -32,7 +32,7 @@ */ #ifdef DEBUG -static const char CVS_ID[] = "@(#) $RCSfile: errorval.c,v $ $Revision: 1.5 $ $Date: 2001-12-10 19:14:32 $ $Name: $"; +static const char CVS_ID[] = "@(#) $RCSfile: errorval.c,v $ $Revision: 1.6 $ $Date: 2001-12-12 20:23:06 $ $Name: $"; #endif /* DEBUG */ /* @@ -85,3 +85,5 @@ const NSSError NSS_ERROR_CERTIFICATE_ISSUER_NOT_FOUND = 31; const NSSError NSS_ERROR_CERTIFICATE_IN_CACHE = 32; +const NSSError NSS_ERROR_HASH_COLLISION = 33; + diff --git a/security/nss/lib/base/hash.c b/security/nss/lib/base/hash.c index 897d28382c6..1a34507feac 100644 --- a/security/nss/lib/base/hash.c +++ b/security/nss/lib/base/hash.c @@ -32,7 +32,7 @@ */ #ifdef DEBUG -static const char CVS_ID[] = "@(#) $RCSfile: hash.c,v $ $Revision: 1.5 $ $Date: 2001-11-29 19:33:59 $ $Name: $"; +static const char CVS_ID[] = "@(#) $RCSfile: hash.c,v $ $Revision: 1.6 $ $Date: 2001-12-12 20:23:07 $ $Name: $"; #endif /* DEBUG */ /* @@ -246,7 +246,7 @@ nssHash_Add const void *value ) { - PRStatus error = PR_SUCCESS; + PRStatus error = PR_FAILURE; PLHashEntry *he; PZ_Lock(hash->mutex); @@ -254,8 +254,11 @@ nssHash_Add he = PL_HashTableAdd(hash->plHashTable, key, (void *)value); if( (PLHashEntry *)NULL == he ) { nss_SetError(NSS_ERROR_NO_MEMORY); + } else if (he->value != value) { + nss_SetError(NSS_ERROR_HASH_COLLISION); } else { hash->count++; + error = PR_SUCCESS; } (void)PZ_Unlock(hash->mutex);