summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrelyea%netscape.com <devnull@localhost>2002-02-28 21:30:13 +0000
committerrelyea%netscape.com <devnull@localhost>2002-02-28 21:30:13 +0000
commit1fe409dd7233a011e5af140a781dad6e2dfe91ea (patch)
tree91a6f303bff781dd40197c6729616fca9cd49a8a
parent2f118ec6ca2da9e45f13009930cd59b72e9256b3 (diff)
downloadnss-hg-1fe409dd7233a011e5af140a781dad6e2dfe91ea.tar.gz
Fix PSM name problem.
Fix crash when trying to access/delete an non-existant object.
-rw-r--r--security/nss/lib/softoken/pk11db.c16
-rw-r--r--security/nss/lib/softoken/pkcs11u.c16
2 files changed, 18 insertions, 14 deletions
diff --git a/security/nss/lib/softoken/pk11db.c b/security/nss/lib/softoken/pk11db.c
index 8b6295a22..fcc906d06 100644
--- a/security/nss/lib/softoken/pk11db.c
+++ b/security/nss/lib/softoken/pk11db.c
@@ -72,9 +72,9 @@ secmod_parseTokenParameters(char *param, pk11_token_parameters *parsed)
index = pk11_argStrip(param);
while (*index) {
- PK11_HANDLE_STRING_ARG(index,parsed->configdir,"configdir=",;)
- PK11_HANDLE_STRING_ARG(index,parsed->certPrefix,"certprefix=",;)
- PK11_HANDLE_STRING_ARG(index,parsed->keyPrefix,"keyprefix=",;)
+ PK11_HANDLE_STRING_ARG(index,parsed->configdir,"configDir=",;)
+ PK11_HANDLE_STRING_ARG(index,parsed->certPrefix,"certPrefix=",;)
+ PK11_HANDLE_STRING_ARG(index,parsed->keyPrefix,"keyPrefix=",;)
PK11_HANDLE_STRING_ARG(index,parsed->tokdes,"tokenDescription=",;)
PK11_HANDLE_STRING_ARG(index,parsed->slotdes,"slotDescription=",;)
PK11_HANDLE_STRING_ARG(index,tmp,"minPWLen=",
@@ -148,13 +148,13 @@ secmod_parseParameters(char *param, pk11_parameters *parsed, PRBool isFIPS)
PORT_Memset(parsed, 0, sizeof(pk11_parameters));
while (*index) {
- PK11_HANDLE_STRING_ARG(index,parsed->configdir,"configdir=",;)
+ PK11_HANDLE_STRING_ARG(index,parsed->configdir,"configDir=",;)
PK11_HANDLE_STRING_ARG(index,parsed->secmodName,"secmod=",;)
- PK11_HANDLE_STRING_ARG(index,parsed->man,"manufactureID=",;)
+ PK11_HANDLE_STRING_ARG(index,parsed->man,"manufacturerID=",;)
PK11_HANDLE_STRING_ARG(index,parsed->libdes,"libraryDescription=",;)
/* constructed values, used so legacy interfaces still work */
- PK11_HANDLE_STRING_ARG(index,certPrefix,"certprefix=",;)
- PK11_HANDLE_STRING_ARG(index,keyPrefix,"keyprefix=",;)
+ PK11_HANDLE_STRING_ARG(index,certPrefix,"certPrefix=",;)
+ PK11_HANDLE_STRING_ARG(index,keyPrefix,"keyPrefix=",;)
PK11_HANDLE_STRING_ARG(index,tokdes,"cryptoTokenDescription=",;)
PK11_HANDLE_STRING_ARG(index,ptokdes,"dbTokenDescription=",;)
PK11_HANDLE_STRING_ARG(index,slotdes,"cryptoSlotDescription=",;)
@@ -258,7 +258,7 @@ secmod_getSecmodName(char *param, PRBool *rw)
while (*param) {
- PK11_HANDLE_STRING_ARG(param,configdir,"configdir=",;)
+ PK11_HANDLE_STRING_ARG(param,configdir,"configDir=",;)
PK11_HANDLE_STRING_ARG(param,secmodName,"secmod=",;)
PK11_HANDLE_FINAL_ARG(param)
}
diff --git a/security/nss/lib/softoken/pkcs11u.c b/security/nss/lib/softoken/pkcs11u.c
index e7e15d0a5..2dd69ed39 100644
--- a/security/nss/lib/softoken/pkcs11u.c
+++ b/security/nss/lib/softoken/pkcs11u.c
@@ -1948,11 +1948,15 @@ pk11_DestroyObject(PK11Object *object)
if (so) {
pk11_PutObjectToList(so);
} else {
- PK11_USE_THREADS(PZ_DestroyLock(object->refLock);)
- PORT_Free(to);;
+ if (object->refLock) {
+ PK11_USE_THREADS(PZ_DestroyLock(object->refLock);)
+ }
+ PORT_Free(to);
}
#else
- PK11_USE_THREADS(PZ_DestroyLock(object->refLock);)
+ if (object->refLock) {
+ PK11_USE_THREADS(PZ_DestroyLock(object->refLock);)
+ }
arena = object->arena;
PORT_FreeArena(arena,PR_FALSE);
#endif
@@ -2557,7 +2561,7 @@ pk11_NewTokenObject(PK11Slot *slot, SECItem *dbKey, CK_OBJECT_HANDLE handle)
arena = PORT_NewArena(2048);
if (arena == NULL) return NULL;
- object = (PK11Object*)PORT_ArenaAlloc(arena,sizeof(PK11TokenObject));
+ object = (PK11Object*)PORT_ArenaZAlloc(arena,sizeof(PK11TokenObject));
if (object == NULL) {
PORT_FreeArena(arena,PR_FALSE);
return NULL;
@@ -2568,7 +2572,6 @@ pk11_NewTokenObject(PK11Slot *slot, SECItem *dbKey, CK_OBJECT_HANDLE handle)
object->objclass = handleToClass(handle);
object->handle = handle;
- object->refCount = 1;
object->slot = slot;
object->objectInfo = NULL;
object->infoFree = NULL;
@@ -2593,11 +2596,12 @@ pk11_NewTokenObject(PK11Slot *slot, SECItem *dbKey, CK_OBJECT_HANDLE handle)
goto loser;
}
#endif
+ object->refCount = 1;
return object;
loser:
if (object) {
- pk11_FreeObject(object);
+ (void) pk11_DestroyObject(object);
}
return NULL;