- Resolves: Bug 784672 - nss should protect against being called before nss_Init

This commit is contained in:
Elio Maldonado 2012-01-26 14:56:36 -08:00
parent b6f8eca453
commit 81470bd3c4
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,40 @@
diff -up mozilla/security/nss/lib/nss/nssinit.c.784672 mozilla/security/nss/lib/nss/nssinit.c
--- mozilla/security/nss/lib/nss/nssinit.c.784672 2012-01-26 14:43:46.232357231 -0800
+++ mozilla/security/nss/lib/nss/nssinit.c 2012-01-26 14:50:55.830512565 -0800
@@ -944,6 +944,12 @@ NSS_RegisterShutdown(NSS_ShutdownFunc sF
{
int i;
+ /* make sure our lock and condition variable are initialized one and only
+ * one time */
+ if (PR_CallOnce(&nssInitOnce, nss_doLockInit) != PR_SUCCESS) {
+ return SECFailure;
+ }
+
PZ_Lock(nssInitLock);
if (!NSS_IsInitialized()) {
PZ_Unlock(nssInitLock);
@@ -1002,6 +1008,11 @@ NSS_UnregisterShutdown(NSS_ShutdownFunc
{
int i;
+ /* make sure our lock and condition variable are initialized one and only
+ * one time */
+ if (PR_CallOnce(&nssInitOnce, nss_doLockInit) != PR_SUCCESS) {
+ return SECFailure;
+ }
PZ_Lock(nssInitLock);
if (!NSS_IsInitialized()) {
PZ_Unlock(nssInitLock);
@@ -1192,6 +1203,11 @@ NSS_ShutdownContext(NSSInitContext *cont
{
SECStatus rv = SECSuccess;
+ /* make sure our lock and condition variable are initialized one and only
+ * one time */
+ if (PR_CallOnce(&nssInitOnce, nss_doLockInit) != PR_SUCCESS) {
+ return SECFailure;
+ }
PZ_Lock(nssInitLock);
/* If one or more threads are in the middle of init, wait for them
* to complete */

View File

@ -7,7 +7,7 @@
Summary: Network Security Services Summary: Network Security Services
Name: nss Name: nss
Version: 3.13.1 Version: 3.13.1
Release: 11%{?dist} Release: 12%{?dist}
License: MPLv1.1 or GPLv2+ or LGPLv2+ License: MPLv1.1 or GPLv2+ or LGPLv2+
URL: http://www.mozilla.org/projects/security/pki/nss/ URL: http://www.mozilla.org/projects/security/pki/nss/
Group: System Environment/Libraries Group: System Environment/Libraries
@ -72,6 +72,7 @@ Patch26: nofipstest.patch
Patch28: nsspem-bz754771.patch Patch28: nsspem-bz754771.patch
# This patch is currently meant for f16 and f15 only # This patch is currently meant for f16 and f15 only
#Patch29: nss-ssl-cbc-random-iv-off-by-default.patch #Patch29: nss-ssl-cbc-random-iv-off-by-default.patch
Patch30: bz784672-protect-against-calls-before-nss_init.patch
%description %description
@ -162,6 +163,7 @@ low level services.
%patch28 -p0 -b .754771 %patch28 -p0 -b .754771
# activate only if requested for f17 # activate only if requested for f17
#%patch29 -p0 -b .770682 #%patch29 -p0 -b .770682
%patch30 -p0 -b .784672
%build %build
@ -576,6 +578,9 @@ rm -rf $RPM_BUILD_ROOT/%{_includedir}/nss3/nsslowhash.h
%changelog %changelog
* Thu Jan 26 2012 Elio Maldonado <emaldona@redhat.com> - 3.13.1-12
- Resolves: Bug 784672 - nss should protect against being called before nss_Init
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.13.1-11 * Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.13.1-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild