1
|
1 |
From: Hans Petter Jansson <hpj@copyleft.no>
|
|
2 |
Wolfgang Rosenauer <wr@rosenauer.org>
|
|
3 |
Subject: use libnsssharedhelper if available at compile time
|
|
4 |
(can be disabled by exporting MOZ_XRE_NO_NSSHELPER=1)
|
|
5 |
References:
|
|
6 |
|
|
7 |
diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in
|
|
8 |
--- a/config/autoconf.mk.in
|
|
9 |
+++ b/config/autoconf.mk.in
|
|
10 |
@@ -548,16 +548,20 @@ MOZ_ENABLE_LIBNOTIFY = @MOZ_ENABLE_LIBNO
|
|
11 |
|
|
12 |
GLIB_CFLAGS = @GLIB_CFLAGS@
|
|
13 |
GLIB_LIBS = @GLIB_LIBS@
|
|
14 |
GLIB_GMODULE_LIBS = @GLIB_GMODULE_LIBS@
|
|
15 |
LIBIDL_CFLAGS = @LIBIDL_CFLAGS@
|
|
16 |
LIBIDL_LIBS = @LIBIDL_LIBS@
|
|
17 |
STATIC_LIBIDL = @STATIC_LIBIDL@
|
|
18 |
|
|
19 |
+MOZ_ENABLE_NSSHELPER = @MOZ_ENABLE_NSSHELPER@
|
|
20 |
+NSSHELPER_CFLAGS = @NSSHELPER_CFLAGS@
|
|
21 |
+NSSHELPER_LIBS = @NSSHELPER_LIBS@
|
|
22 |
+
|
|
23 |
MOZ_NATIVE_MAKEDEPEND = @SYSTEM_MAKEDEPEND@
|
|
24 |
|
|
25 |
MOZ_AUTO_DEPS = @MOZ_AUTO_DEPS@
|
|
26 |
COMPILER_DEPEND = @COMPILER_DEPEND@
|
|
27 |
MDDEPDIR := @MDDEPDIR@
|
|
28 |
|
|
29 |
MOZ_DEMANGLE_SYMBOLS = @MOZ_DEMANGLE_SYMBOLS@
|
|
30 |
|
|
31 |
diff --git a/configure.in b/configure.in
|
|
32 |
--- a/configure.in
|
|
33 |
+++ b/configure.in
|
|
34 |
@@ -7756,16 +7756,31 @@ AC_SUBST(MOZ_CAIRO_LIBS)
|
|
35 |
|
|
36 |
dnl qcms
|
|
37 |
dnl ========================================================
|
|
38 |
|
|
39 |
QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
|
|
40 |
AC_SUBST(QCMS_LIBS)
|
|
41 |
|
|
42 |
dnl ========================================================
|
|
43 |
+dnl Check for nss-shared-helper
|
|
44 |
+dnl ========================================================
|
|
45 |
+
|
|
46 |
+ PKG_CHECK_MODULES(NSSHELPER, nss-shared-helper,
|
|
47 |
+ [MOZ_ENABLE_NSSHELPER=1],
|
|
48 |
+ [MOZ_ENABLE_NSSHELPER=])
|
|
49 |
+
|
|
50 |
+if test "$MOZ_ENABLE_NSSHELPER"; then
|
|
51 |
+ AC_DEFINE(MOZ_ENABLE_NSSHELPER)
|
|
52 |
+fi
|
|
53 |
+AC_SUBST(MOZ_ENABLE_NSSHELPER)
|
|
54 |
+AC_SUBST(NSSHELPER_CFLAGS)
|
|
55 |
+AC_SUBST(NSSHELPER_LIBS)
|
|
56 |
+
|
|
57 |
+dnl ========================================================
|
|
58 |
dnl disable xul
|
|
59 |
dnl ========================================================
|
|
60 |
MOZ_ARG_DISABLE_BOOL(xul,
|
|
61 |
[ --disable-xul Disable XUL],
|
|
62 |
MOZ_XUL= )
|
|
63 |
if test "$MOZ_XUL"; then
|
|
64 |
AC_DEFINE(MOZ_XUL)
|
|
65 |
else
|
|
66 |
diff --git a/security/manager/ssl/src/Makefile.in b/security/manager/ssl/src/Makefile.in
|
|
67 |
--- a/security/manager/ssl/src/Makefile.in
|
|
68 |
+++ b/security/manager/ssl/src/Makefile.in
|
|
69 |
@@ -133,19 +133,20 @@ REQUIRES = nspr \
|
|
70 |
$(NULL)
|
|
71 |
|
|
72 |
EXTRA_DEPS = $(NSS_DEP_LIBS)
|
|
73 |
|
|
74 |
DEFINES += -DNSS_ENABLE_ECC
|
|
75 |
|
|
76 |
# Use local includes because they are inserted before INCLUDES
|
|
77 |
# so that Mozilla's nss.h is used, not glibc's
|
|
78 |
-LOCAL_INCLUDES += $(NSS_CFLAGS)
|
|
79 |
+LOCAL_INCLUDES += $(NSS_CFLAGS) $(NSSHELPER_CFLAGS)
|
|
80 |
|
|
81 |
EXTRA_DSO_LDOPTS += \
|
|
82 |
$(MOZ_UNICHARUTIL_LIBS) \
|
|
83 |
$(MOZ_COMPONENT_LIBS) \
|
|
84 |
$(MOZ_JS_LIBS) \
|
|
85 |
+ $(NSSHELPER_LIBS) \
|
|
86 |
$(NSS_LIBS) \
|
|
87 |
$(NULL)
|
|
88 |
|
|
89 |
include $(topsrcdir)/config/rules.mk
|
|
90 |
|
|
91 |
diff --git a/security/manager/ssl/src/nsNSSComponent.cpp b/security/manager/ssl/src/nsNSSComponent.cpp
|
|
92 |
--- a/security/manager/ssl/src/nsNSSComponent.cpp
|
|
93 |
+++ b/security/manager/ssl/src/nsNSSComponent.cpp
|
|
94 |
@@ -39,16 +39,23 @@
|
|
95 |
* use your version of this file under the terms of the MPL, indicate your
|
|
96 |
* decision by deleting the provisions above and replace them with the notice
|
|
97 |
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
98 |
* the provisions above, a recipient may use your version of this file under
|
|
99 |
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
100 |
*
|
|
101 |
* ***** END LICENSE BLOCK ***** */
|
|
102 |
|
|
103 |
+#ifdef MOZ_ENABLE_NSSHELPER
|
|
104 |
+#pragma GCC visibility push(default)
|
|
105 |
+#include <nss-shared-helper.h>
|
|
106 |
+#pragma GCC visibility pop
|
|
107 |
+#include "prenv.h"
|
|
108 |
+#endif
|
|
109 |
+
|
|
110 |
#include "nsNSSComponent.h"
|
|
111 |
#include "nsNSSCallbacks.h"
|
|
112 |
#include "nsNSSIOLayer.h"
|
|
113 |
#include "nsSSLThread.h"
|
|
114 |
#include "nsCertVerificationThread.h"
|
|
115 |
|
|
116 |
#include "nsNetUtil.h"
|
|
117 |
#include "nsAppDirectoryServiceDefs.h"
|
|
118 |
@@ -1600,17 +1607,31 @@ nsNSSComponent::InitializeNSS(PRBool sho
|
|
119 |
// The call to ConfigureInternalPKCS11Token needs to be done before NSS is initialized,
|
|
120 |
// but affects only static data.
|
|
121 |
// If we could assume i18n will not change between profiles, one call per application
|
|
122 |
// run were sufficient. As I can't predict what happens in the future, let's repeat
|
|
123 |
// this call for every re-init of NSS.
|
|
124 |
|
|
125 |
ConfigureInternalPKCS11Token();
|
|
126 |
|
|
127 |
- SECStatus init_rv = ::NSS_InitReadWrite(profileStr.get());
|
|
128 |
+ SECStatus init_rv = SECFailure;
|
|
129 |
+#ifdef MOZ_ENABLE_NSSHELPER
|
|
130 |
+ if (PR_GetEnv("MOZ_XRE_NO_NSSHELPER")) {
|
|
131 |
+ init_rv = ::NSS_InitReadWrite(profileStr.get());
|
|
132 |
+ } else {
|
|
133 |
+ init_rv = ::nsshelp_open_db ("mozilla-xul", profileStr.get(), 0);
|
|
134 |
+
|
|
135 |
+ if (init_rv != SECSuccess) {
|
|
136 |
+ PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("can not init NSS using nsshelp_open_db in %s\n", profileStr.get()));
|
|
137 |
+ init_rv = ::NSS_InitReadWrite(profileStr.get());
|
|
138 |
+ }
|
|
139 |
+ }
|
|
140 |
+#else
|
|
141 |
+ init_rv = ::NSS_InitReadWrite(profileStr.get());
|
|
142 |
+#endif
|
|
143 |
|
|
144 |
if (init_rv != SECSuccess) {
|
|
145 |
PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("can not init NSS r/w in %s\n", profileStr.get()));
|
|
146 |
|
|
147 |
if (supress_warning_preference) {
|
|
148 |
which_nss_problem = problem_none;
|
|
149 |
}
|
|
150 |
else {
|
|
151 |
diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in
|
|
152 |
--- a/toolkit/library/Makefile.in
|
|
153 |
+++ b/toolkit/library/Makefile.in
|
|
154 |
@@ -189,17 +189,17 @@ else
|
|
155 |
EXTRA_DSO_LDOPTS += \
|
|
156 |
$(MOZ_COMPONENT_LIBS) \
|
|
157 |
$(MOZ_JS_LIBS) \
|
|
158 |
$(NULL)
|
|
159 |
endif
|
|
160 |
|
|
161 |
DEFINES += -DIMPL_XREAPI
|
|
162 |
|
|
163 |
-EXTRA_DSO_LDOPTS += $(NSPR_LIBS)
|
|
164 |
+EXTRA_DSO_LDOPTS += $(NSPR_LIBS) $(NSSHELPER_LIBS)
|
|
165 |
|
|
166 |
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
|
167 |
CXXFLAGS += $(TK_CFLAGS)
|
|
168 |
EXTRA_DSO_LDOPTS += \
|
|
169 |
-framework SystemConfiguration \
|
|
170 |
-framework QuickTime \
|
|
171 |
-framework IOKit \
|
|
172 |
-lcrypto \
|