From 8abaf403994e98fa20293ce1e192db53f79b5481 Mon Sep 17 00:00:00 2001 From: Jim Cummins Date: Thu, 1 Feb 2018 15:27:44 -0600 Subject: [PATCH] fix: prefer the later version of firefox's db In the current scenario if you did update your FF then the old db is used because it still exists (FF doesn't clean it up). This fixes that by instead preferring the new db if it exists. --- src/install-authority.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/install-authority.ts b/src/install-authority.ts index 3926454..750b9da 100644 --- a/src/install-authority.ts +++ b/src/install-authority.ts @@ -106,10 +106,10 @@ async function addCertificateToNSSCertDB (commonName: string, rootCertPath: stri } glob.sync(nssDirGlob).forEach(potentialNSSDBDir => { - if (existsSync(path.join(potentialNSSDBDir, 'cert8.db'))) - execSync(`${certutilPath} -A -d "${potentialNSSDBDir}" -t 'C,,' -i ${rootCertPath} -n ${commonName}`); - else if (existsSync(path.join(potentialNSSDBDir, 'cert9.db'))) + if (existsSync(path.join(potentialNSSDBDir, 'cert9.db'))) execSync(`${certutilPath} -A -d "sql:${potentialNSSDBDir}" -t 'C,,' -i ${rootCertPath} -n ${commonName}`); + else if (existsSync(path.join(potentialNSSDBDir, 'cert8.db'))) + execSync(`${certutilPath} -A -d "${potentialNSSDBDir}" -t 'C,,' -i ${rootCertPath} -n ${commonName}`); }); }