summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornelsonb%netscape.com <devnull@localhost>2000-10-06 21:45:01 +0000
committernelsonb%netscape.com <devnull@localhost>2000-10-06 21:45:01 +0000
commit42636a069ddc09094073384d74b47196ccdba34b (patch)
tree0cdc1df504df70880e0507b919d9f15c85ac7a8f
parent22617e2d7d4ae28631e19bbbd313b295e6ae3dfd (diff)
downloadnss-hg-42636a069ddc09094073384d74b47196ccdba34b.tar.gz
Call NSS_InitReadWrite instead of SECU_PKCS11Init, and check the result
for success. Fixes a crash. If it turns out that cmsutil doesn't need to modifiy the cert and/or key DBs, then it should call NSS_Init, instead.
-rw-r--r--security/nss/cmd/smimetools/cmsutil.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/security/nss/cmd/smimetools/cmsutil.c b/security/nss/cmd/smimetools/cmsutil.c
index 1ac0b9469..eff4bf6ec 100644
--- a/security/nss/cmd/smimetools/cmsutil.c
+++ b/security/nss/cmd/smimetools/cmsutil.c
@@ -46,6 +46,7 @@
#include "cdbhdl.h"
#include "secoid.h"
#include "cms.h"
+#include "nss.h"
#include "smime.h"
#if defined(XP_UNIX)
@@ -1102,16 +1103,16 @@ main(int argc, char **argv)
/* Call the libsec initialization routines */
PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
- SECU_PKCS11Init(PR_FALSE);
- RNG_SystemInfoForRNG(); /* SECU_PKCS11Init does not call this */
- SEC_Init(); /* this does nothing, actually */
-
- /* open cert database */
- options.certHandle = OpenCertDB(progName);
- if (options.certHandle == NULL) {
- return -1;
+ rv = NSS_InitReadWrite(SECU_ConfigDirectory(NULL));
+ if (SECSuccess != rv) {
+ SECU_PrintError(progName, "NSS_Init failed");
+ exit(1);
+ }
+ options.certHandle = CERT_GetDefaultCertDB();
+ if (!options.certHandle) {
+ SECU_PrintError(progName, "No default cert DB");
+ exit(1);
}
- CERT_SetDefaultCertDB(options.certHandle);
exitstatus = 0;
switch (mode) {