[PATCH] Add nss shared db data and use it

Wald Commits scm-commit at wald.intevation.org
Thu Jul 24 12:09:34 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1406196568 -7200
# Node ID 344d15e23f6c0d84fa24bdc7ce3cf53414c6a5d9
# Parent  294d76174102ad6ff1ff83c6de4a77164a718cad
Add nss shared db data and use it.

diff -r 294d76174102 -r 344d15e23f6c ui/tests/data/nss/pki-nssdb/cert9.db
Binary file ui/tests/data/nss/pki-nssdb/cert9.db has changed
diff -r 294d76174102 -r 344d15e23f6c ui/tests/data/nss/pki-nssdb/key4.db
Binary file ui/tests/data/nss/pki-nssdb/key4.db has changed
diff -r 294d76174102 -r 344d15e23f6c ui/tests/data/nss/pki-nssdb/pkcs11.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/tests/data/nss/pki-nssdb/pkcs11.txt	Thu Jul 24 12:09:28 2014 +0200
@@ -0,0 +1,5 @@
+library=
+name=NSS Internal PKCS #11 Module
+parameters=configdir='sql:TOREPLACE' certPrefix='' keyPrefix='' secmod='secmod.db' flags=optimizeSpace updatedir='' updateCertPrefix='' updateKeyPrefix='' updateid='' updateTokenDescription='' 
+NSS=Flags=internal,critical trustOrder=75 cipherOrder=100 slotParams=(1={slotFlags=[RSA,DSA,DH,RC2,RC4,DES,RANDOM,SHA1,MD5,MD2,SSL,TLS,AES,Camellia,SEED,SHA256,SHA512] askpw=any timeout=30})
+
diff -r 294d76174102 -r 344d15e23f6c ui/tests/data/testdata.qrc
--- a/ui/tests/data/testdata.qrc	Thu Jul 24 11:41:52 2014 +0200
+++ b/ui/tests/data/testdata.qrc	Thu Jul 24 12:09:28 2014 +0200
@@ -7,6 +7,9 @@
     <file>nss/cert8.db</file>
     <file>nss/key3.db</file>
     <file>nss/secmod.db</file>
+    <file>nss/pki-nssdb/cert9.db</file>
+    <file>nss/pki-nssdb/key4.db</file>
+    <file>nss/pki-nssdb/pkcs11.txt</file>
     <file>import_test.pem</file>
     <file>valid_ssl_rsa.pem</file>
     <file>valid_ssl_bp.pem</file>
diff -r 294d76174102 -r 344d15e23f6c ui/tests/nsstest.cpp
--- a/ui/tests/nsstest.cpp	Thu Jul 24 11:41:52 2014 +0200
+++ b/ui/tests/nsstest.cpp	Thu Jul 24 12:09:28 2014 +0200
@@ -95,14 +95,20 @@
     /* Copy the current systems NSSSHARED db in the fake home for benchmark tests */
     QDir fakeNSSSharedDir = fakeHome.path() + "/.pki/nssdb";
     QVERIFY(fakeNSSSharedDir.mkpath(fakeNSSSharedDir.path()));
-    qDebug() << "Copying: " << QDir::homePath() + "/.pki/nssdb/cert9.db" <<
-            " to " << fakeNSSSharedDir.path() + "cert9.db";
-    QVERIFY(QFile::copy(QDir::homePath() + "/.pki/nssdb/cert9.db",
+    QVERIFY(QFile::copy(":/nss/pki-nssdb/cert9.db",
             fakeNSSSharedDir.path() + "cert9.db"));
-    QVERIFY(QFile::copy(QDir::homePath() + "/.pki/nssdb/key4.db",
+    QVERIFY(QFile::copy(":/nss/pki-nssdb/key4.db",
             fakeNSSSharedDir.path() + "key4.db"));
-    QVERIFY(QFile::copy(QDir::homePath() + "/.pki/nssdb/pkcs11.txt",
-            fakeNSSSharedDir.path() + "pkcs11.txt"));
+    QFile pkcs11(":/nss/pki-nssdb/pkcs11.txt");
+    pkcs11.open(QIODevice::ReadOnly);
+
+    QString pkcs11content = pkcs11.readAll();
+    pkcs11.close();
+    pkcs11content.replace("TOREPLACE", fakeNSSSharedDir.path());
+    QFile p11outfile (fakeNSSSharedDir.path() + "pkcs11.txt");
+    p11outfile.open(QIODevice::WriteOnly);
+    p11outfile.write(pkcs11content.toUtf8());
+    p11outfile.close();
 
     QVERIFY(!setenv ("HOME", fakeHome.path().toLocal8Bit().constData(), 1));
 #else


More information about the Trustbridge-commits mailing list