From 78298d51bfa5ade0e2e76a2aea2888325cc512db Mon Sep 17 00:00:00 2001 From: "javi%netscape.com" Date: Tue, 19 Dec 2000 22:49:42 +0000 Subject: [PATCH] Don't error out when creating the list of PKCS#11 modules if one wasn't loaded correctly. git-svn-id: svn://10.0.0.236/trunk@83866 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/security/psm/server/pkcs11ui.c | 29 +++++++++++++++----------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/mozilla/security/psm/server/pkcs11ui.c b/mozilla/security/psm/server/pkcs11ui.c index 91a515ee6bf..fd1b13033e6 100644 --- a/mozilla/security/psm/server/pkcs11ui.c +++ b/mozilla/security/psm/server/pkcs11ui.c @@ -74,7 +74,7 @@ ssmpkcs11_convert_module(SSMTextGenContext *cx, { char *dllName = NULL; char *tempStr = NULL; - char *lib_ch = NULL; + char *lib_ch = NULL; CK_INFO modInfo; SSMStatus rv = SSM_FAILURE; SECStatus srv; @@ -83,17 +83,25 @@ ssmpkcs11_convert_module(SSMTextGenContext *cx, char buf2[65]; srv = PK11_GetModInfo(mod, &modInfo); - if (srv != SECSuccess) - goto loser; - - /* we provide the space in (buf), so we don't deallocate lib_ch */ - lib_ch = PK11_MakeString(NULL,buf2,(char *)modInfo.libraryDescription, - sizeof(modInfo.libraryDescription)); + if (srv != SECSuccess) { + /* + * The module was not properly loaded at start-up, + * so just make all the strings blank. + */ + lib_ch = ""; + buf[0] = '\0'; + } else { + /* we provide the space in (buf), so we don't deallocate lib_ch */ + lib_ch = PK11_MakeString(NULL,buf2,(char *)modInfo.libraryDescription, + sizeof(modInfo.libraryDescription)); + PR_snprintf(buf, sizeof(buf), "%d.%d", + modInfo.libraryVersion.major, modInfo.libraryVersion.minor); + } if (mod->dllName) { char *cursor, *newString; int numSlashes = 0, newLen, i, j, oldLen; - + dllName = mod->dllName; /* * Now we need to escape the '\' characters so the string shows @@ -132,10 +140,7 @@ ssmpkcs11_convert_module(SSMTextGenContext *cx, if (rv != SSM_SUCCESS) goto loser; } - - PR_snprintf(buf, sizeof(buf), "%d.%d", - modInfo.libraryVersion.major, modInfo.libraryVersion.minor); - + tempStr = PR_smprintf(fmt, modIndex, (long)mod->moduleID, lib_ch, mod->commonName, dllName, buf); if (tempStr == NULL) {