diff options
author | jpierre%netscape.com <devnull@localhost> | 2002-02-12 04:09:21 +0000 |
---|---|---|
committer | jpierre%netscape.com <devnull@localhost> | 2002-02-12 04:09:21 +0000 |
commit | 551362d9a04f5927611f75272b417a208237acb8 (patch) | |
tree | 9e7ae05075aa02e83fd8b1d510dd5e857418694a | |
parent | ac3259a029a7243ff8d9b8fa2107031bfc253972 (diff) | |
download | nss-hg-551362d9a04f5927611f75272b417a208237acb8.tar.gz |
Make modutil display a more detailed error when a PKCS#11 module fails to load. This is done by checking the NSPR error text that is set by PR_LoadLibrary failures deep in SECMOD_AddNewModule
-rw-r--r-- | security/nss/cmd/modutil/error.h | 2 | ||||
-rw-r--r-- | security/nss/cmd/modutil/pk11.c | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/security/nss/cmd/modutil/error.h b/security/nss/cmd/modutil/error.h index 42583a355..560e317db 100644 --- a/security/nss/cmd/modutil/error.h +++ b/security/nss/cmd/modutil/error.h @@ -58,6 +58,7 @@ typedef enum { DIR_NOT_WRITEABLE_ERR, INVALID_CONSTANT_ERR, ADD_MODULE_FAILED_ERR, + ADD_MODULE_FAILED_STATUS_ERR, OUT_OF_MEM_ERR, DELETE_INTERNAL_ERR, DELETE_FAILED_ERR, @@ -111,6 +112,7 @@ static char *errStrings[] = { "ERROR: Directory \"%s\" is not writeable.\n", "\"%s\" is not a recognized value.\n", "ERROR: Failed to add module \"%s\".\n", + "ERROR: Failed to add module \"%s\". Probable cause : \"%s\".\n", "ERROR: Out of memory.\n", "ERROR: Cannot delete internal module.\n", "ERROR: Failed to delete module \"%s\".\n", diff --git a/security/nss/cmd/modutil/pk11.c b/security/nss/cmd/modutil/pk11.c index d20807b06..a3ef9a9f5 100644 --- a/security/nss/cmd/modutil/pk11.c +++ b/security/nss/cmd/modutil/pk11.c @@ -239,7 +239,19 @@ AddModule(char *moduleName, char *libFile, char *cipherString, SECMOD_PubCipherFlagstoInternal(ciphers) ); if(status != SECSuccess) { - PR_fprintf(PR_STDERR, errStrings[ADD_MODULE_FAILED_ERR], moduleName); + char* errtxt=NULL; + PRInt32 copied = 0; + if (PR_GetErrorTextLength()) { + errtxt = malloc(PR_GetErrorTextLength()); + copied = PR_GetErrorText(errtxt); + } + if (copied && errtxt) { + PR_fprintf(PR_STDERR, errStrings[ADD_MODULE_FAILED_STATUS_ERR], moduleName, errtxt); + free(errtxt); + } + else { + PR_fprintf(PR_STDERR, errStrings[ADD_MODULE_FAILED_ERR], moduleName); + } return ADD_MODULE_FAILED_ERR; } else { PR_fprintf(PR_STDOUT, msgStrings[ADD_MODULE_SUCCESS_MSG], moduleName); |