/[packages]/updates/8/java-1.8.0-openjdk/current/SOURCES/jdk8195607-pr3776-rh1760437-nss_sqlite_db_config.patch
ViewVC logotype

Contents of /updates/8/java-1.8.0-openjdk/current/SOURCES/jdk8195607-pr3776-rh1760437-nss_sqlite_db_config.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1760808 - (show annotations) (download)
Sun Dec 5 13:32:17 2021 UTC (17 months, 3 weeks ago) by neoclust
File size: 5303 byte(s)
New version jdk8u312-b07 (mga#29590)
1 # HG changeset patch
2 # User mbalao
3 # Date 1529971845 -28800
4 # Tue Jun 26 08:10:45 2018 +0800
5 # Node ID e9c20b7250cd98d16a67f2a30b34284c2caa01dc
6 # Parent 9f1aa2e38d90dd60522237d7414af6bdcf03c4ff
7 8195607, PR3776: sun/security/pkcs11/Secmod/TestNssDbSqlite.java failed with "NSS initialization failed" on NSS 3.34.1
8 Reviewed-by: valeriep, weijun
9
10 diff --git openjdk.orig/jdk/src/share/classes/sun/security/pkcs11/Secmod.java openjdk/jdk/src/share/classes/sun/security/pkcs11/Secmod.java
11 --- openjdk.orig/jdk/src/share/classes/sun/security/pkcs11/Secmod.java
12 +++ openjdk/jdk/src/share/classes/sun/security/pkcs11/Secmod.java
13 @@ -197,7 +197,7 @@
14
15 if (configDir != null) {
16 String configDirPath = null;
17 - String sqlPrefix = "sql:/";
18 + String sqlPrefix = "sql:";
19 if (!configDir.startsWith(sqlPrefix)) {
20 configDirPath = configDir;
21 } else {
22 diff --git openjdk.orig/jdk/src/share/native/sun/security/pkcs11/j2secmod.c openjdk/jdk/src/share/native/sun/security/pkcs11/j2secmod.c
23 --- openjdk.orig/jdk/src/share/native/sun/security/pkcs11/j2secmod.c
24 +++ openjdk/jdk/src/share/native/sun/security/pkcs11/j2secmod.c
25 @@ -69,9 +69,14 @@
26 int res = 0;
27 FPTR_Initialize initialize =
28 (FPTR_Initialize)findFunction(env, jHandle, "NSS_Initialize");
29 + #ifdef SECMOD_DEBUG
30 + FPTR_GetError getError =
31 + (FPTR_GetError)findFunction(env, jHandle, "PORT_GetError");
32 + #endif // SECMOD_DEBUG
33 unsigned int flags = 0x00;
34 const char *configDir = NULL;
35 const char *functionName = NULL;
36 + const char *configFile = NULL;
37
38 /* If we cannot initialize, exit now */
39 if (initialize == NULL) {
40 @@ -97,13 +102,18 @@
41 flags = 0x20; // NSS_INIT_OPTIMIZESPACE flag
42 }
43
44 + configFile = "secmod.db";
45 + if (configDir != NULL && strncmp("sql:", configDir, 4U) == 0) {
46 + configFile = "pkcs11.txt";
47 + }
48 +
49 /*
50 * If the NSS_Init function is requested then call NSS_Initialize to
51 * open the Cert, Key and Security Module databases, read only.
52 */
53 if (strcmp("NSS_Init", functionName) == 0) {
54 flags = flags | 0x01; // NSS_INIT_READONLY flag
55 - res = initialize(configDir, "", "", "secmod.db", flags);
56 + res = initialize(configDir, "", "", configFile, flags);
57
58 /*
59 * If the NSS_InitReadWrite function is requested then call
60 @@ -111,7 +121,7 @@
61 * read/write.
62 */
63 } else if (strcmp("NSS_InitReadWrite", functionName) == 0) {
64 - res = initialize(configDir, "", "", "secmod.db", flags);
65 + res = initialize(configDir, "", "", configFile, flags);
66
67 /*
68 * If the NSS_NoDB_Init function is requested then call
69 @@ -137,6 +147,13 @@
70 (*env)->ReleaseStringUTFChars(env, jConfigDir, configDir);
71 }
72 dprintf1("-res: %d\n", res);
73 + #ifdef SECMOD_DEBUG
74 + if (res == -1) {
75 + if (getError != NULL) {
76 + dprintf1("-NSS error: %d\n", getError());
77 + }
78 + }
79 + #endif // SECMOD_DEBUG
80
81 return (res == 0) ? JNI_TRUE : JNI_FALSE;
82 }
83 diff --git openjdk.orig/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.h openjdk/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.h
84 --- openjdk.orig/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.h
85 +++ openjdk/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.h
86 @@ -34,6 +34,10 @@
87 const char *certPrefix, const char *keyPrefix,
88 const char *secmodName, unsigned int flags);
89
90 +#ifdef SECMOD_DEBUG
91 +typedef int (*FPTR_GetError)(void);
92 +#endif //SECMOD_DEBUG
93 +
94 // in secmod.h
95 //extern SECMODModule *SECMOD_LoadModule(char *moduleSpec,SECMODModule *parent,
96 // PRBool recurse);
97 diff --git openjdk.orig/jdk/test/sun/security/pkcs11/Secmod/pkcs11.txt openjdk/jdk/test/sun/security/pkcs11/Secmod/pkcs11.txt
98 new file mode 100644
99 --- /dev/null
100 +++ openjdk/jdk/test/sun/security/pkcs11/Secmod/pkcs11.txt
101 @@ -0,0 +1,4 @@
102 +library=
103 +name=NSS Internal PKCS #11 Module
104 +parameters=configdir='sql:./tmpdb' certPrefix='' keyPrefix='' secmod='' flags= updatedir='' updateCertPrefix='' updateKeyPrefix='' updateid='' updateTokenDescription=''
105 +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})
106 diff --git openjdk.orig/jdk/test/sun/security/pkcs11/SecmodTest.java openjdk/jdk/test/sun/security/pkcs11/SecmodTest.java
107 --- openjdk.orig/jdk/test/sun/security/pkcs11/SecmodTest.java
108 +++ openjdk/jdk/test/sun/security/pkcs11/SecmodTest.java
109 @@ -55,7 +55,7 @@
110
111 DBDIR = System.getProperty("test.classes", ".") + SEP + "tmpdb";
112 if (useSqlite) {
113 - System.setProperty("pkcs11test.nss.db", "sql:/" + DBDIR);
114 + System.setProperty("pkcs11test.nss.db", "sql:" + DBDIR);
115 } else {
116 System.setProperty("pkcs11test.nss.db", DBDIR);
117 }
118 @@ -67,6 +67,7 @@
119 if (useSqlite) {
120 copyFile("key4.db", BASE, DBDIR);
121 copyFile("cert9.db", BASE, DBDIR);
122 + copyFile("pkcs11.txt", BASE, DBDIR);
123 } else {
124 copyFile("secmod.db", BASE, DBDIR);
125 copyFile("key3.db", BASE, DBDIR);

  ViewVC Help
Powered by ViewVC 1.1.28