nss/546221.patch
2009-12-20 06:17:58 +00:00

86 lines
3.0 KiB
Diff

diff -up nss-3.12.5/mozilla/security/nss/lib/sysinit/nsssysinit.c.546221 nss-3.12.5/mozilla/security/nss/lib/sysinit/nsssysinit.c
--- nss-3.12.5/mozilla/security/nss/lib/sysinit/nsssysinit.c.546221 2009-12-19 21:11:06.590930221 -0800
+++ nss-3.12.5/mozilla/security/nss/lib/sysinit/nsssysinit.c 2009-12-19 21:17:29.019931181 -0800
@@ -37,8 +37,6 @@
#include "prio.h"
#include "prprf.h"
-
-
/*
* The following provides a default example for operating systems to set up
* and manage applications loading NSS on their OS globally.
@@ -208,8 +206,8 @@ askpw=any timeout=30 ] } ";
static char **
get_list(char *filename, char *stripped_parameters)
{
- char **module_list = PORT_ZNewArray(char *, 4);
- char *userdb;
+ char **module_list = PORT_ZNewArray(char *, 5);
+ char *userdb, *sysdb;
int isFIPS = getFIPSMode();
const char *nssflags = isFIPS ? nssDefaultFIPSFlags : nssDefaultFlags;
int next = 0;
@@ -219,13 +217,20 @@ get_list(char *filename, char *stripped_
return NULL;
}
- userdb = getUserDB();
+ userdb = getSystemDB();
+ userdb = getUserDB();
+
+ if (sysdb && !strcmp(filename, sysdb))
+ filename = NULL;
+ if (userdb && !strcmp(filename, userdb))
+ filename = NULL;
+
if (userdb != NULL) {
/* return a list of databases to open. First the user Database */
module_list[next++] = PR_smprintf(
"library= "
"module=\"NSS User database\" "
- "parameters=\"configdir='sql:%s' %s\" "
+ "parameters=\"configdir='sql:%s' %s tokenDescription='NSS user database'\" "
"NSS=\"%sflags=internal%s\"",
userdb, stripped_parameters, nssflags,
isFIPS ? ",FIPS" : "");
@@ -238,19 +243,32 @@ get_list(char *filename, char *stripped_
"parameters=\"configdir='sql:%s' %s\" "
"NSS=\"flags=internal,moduleDBOnly,defaultModDB,skipFirst\"",
userdb, stripped_parameters);
- }
+ }
+
+ if (filename && 0 /* This doesn't actually work. If we register
+ both this and the sysdb (in either order)
+ then only one of them actually shows up */) {
+ module_list[next++] = PR_smprintf(
+ "library= "
+ "module=\"NSS database\" "
+ "parameters=\"configdir='sql:%s' tokenDescription='NSS database sql:%s'\" "
+ "NSS=\"%sflags=internal\"",filename, filename, nssflags);
+ }
/* now the system database (always read only) */
- module_list[next++] = PR_smprintf(
- "library= "
- "module=\"NSS system database\" "
- "parameters=\"configdir='sql:%s' tokenDescription='NSS system database' flags=readonly\" "
- "NSS=\"%sflags=internal,critical\"",filename, nssDefaultFlags);
+ if (sysdb) {
+ module_list[next++] = PR_smprintf(
+ "library= "
+ "module=\"NSS system database\" "
+ "parameters=\"configdir='sql:%s' tokenDescription='NSS system database' flags=readonly\" "
+ "NSS=\"%sflags=internal,critical\"",sysdb, nssflags);
+ }
/* that was the last module */
module_list[next] = 0;
PORT_Free(userdb);
+ PORT_Free(sysdb);
return module_list;
}