summaryrefslogtreecommitdiff
path: root/security/nss/lib/softoken/keydb.c
diff options
context:
space:
mode:
authorrelyea%netscape.com <devnull@localhost>2002-08-02 21:41:01 +0000
committerrelyea%netscape.com <devnull@localhost>2002-08-02 21:41:01 +0000
commitd670347f4db39c287ed40c0fc43a5b5ef6154ce7 (patch)
treecc8dc57214afa747c87e7323bee13e67a682fcc6 /security/nss/lib/softoken/keydb.c
parent7b5a8e0334a2c71af8d041acfd2f51ba555c0d06 (diff)
downloadnss-hg-d670347f4db39c287ed40c0fc43a5b5ef6154ce7.tar.gz
Turn on reset functionality for multiaccessdb clients.
Diffstat (limited to 'security/nss/lib/softoken/keydb.c')
-rw-r--r--security/nss/lib/softoken/keydb.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/security/nss/lib/softoken/keydb.c b/security/nss/lib/softoken/keydb.c
index 21add55d1..897946dae 100644
--- a/security/nss/lib/softoken/keydb.c
+++ b/security/nss/lib/softoken/keydb.c
@@ -955,7 +955,9 @@ nsslowkey_OpenKeyDB(PRBool readOnly, const char *appName, const char *prefix,
goto loser;
}
- handle->dbname = PORT_Strdup(dbname);
+ handle->appname = appName ? PORT_Strdup(appName) : NULL ;
+ handle->dbname = appName ? PORT_Strdup(dbname) :
+ (prefix ? PORT_Strdup(prefix) : NULL);
handle->readOnly = readOnly;
if (appName) {
@@ -1022,6 +1024,7 @@ nsslowkey_CloseKeyDB(NSSLOWKEYDBHandle *handle)
(* handle->db->close)(handle->db);
}
if (handle->dbname) PORT_Free(handle->dbname);
+ if (handle->appname) PORT_Free(handle->appname);
if (handle->global_salt) {
SECITEM_FreeItem(handle->global_salt,PR_TRUE);
}
@@ -2419,13 +2422,16 @@ nsslowkey_ResetKeyDB(NSSLOWKEYDBHandle *handle)
return SECFailure;
}
- PORT_Assert(handle->dbname != NULL);
- if (handle->dbname == NULL) {
+ if (handle->appname == NULL && handle->dbname == NULL) {
return SECFailure;
}
(* handle->db->close)(handle->db);
- handle->db = dbopen( handle->dbname, NO_CREATE, 0600, DB_HASH, 0 );
+ if (handle->appname) {
+ handle->db=rdbopen(handle->appname, handle->dbname, "key", NO_CREATE);
+ } else {
+ handle->db = dbopen( handle->dbname, NO_CREATE, 0600, DB_HASH, 0 );
+ }
if (handle->db == NULL) {
/* set an error code */
return SECFailure;