mozilla-shared-nss-db.patch
changeset 716 cef565f1c325
parent 703 c4aab80e472f
child 718 6cb1ac7cd223
equal deleted inserted replaced
715:e1c226a4de34 716:cef565f1c325
     5 References:
     5 References:
     6 
     6 
     7 diff --git a/configure.in b/configure.in
     7 diff --git a/configure.in b/configure.in
     8 --- a/configure.in
     8 --- a/configure.in
     9 +++ b/configure.in
     9 +++ b/configure.in
    10 @@ -8042,16 +8042,31 @@ if test "$MOZ_ENABLE_SKIA"; then
    10 @@ -8113,16 +8113,31 @@ if test "$MOZ_ENABLE_SKIA"; then
    11      MOZ_ENABLE_SKIA_GPU=1
    11      MOZ_ENABLE_SKIA_GPU=1
    12      AC_DEFINE(USE_SKIA_GPU)
    12      AC_DEFINE(USE_SKIA_GPU)
    13      AC_SUBST(MOZ_ENABLE_SKIA_GPU)
    13      AC_SUBST(MOZ_ENABLE_SKIA_GPU)
    14    fi
    14    fi
    15  fi
    15  fi
    71 +#include "prenv.h"
    71 +#include "prenv.h"
    72 +#endif
    72 +#endif
    73 +
    73 +
    74  #include "nsNSSComponent.h"
    74  #include "nsNSSComponent.h"
    75  
    75  
    76  #include "CertVerifier.h"
    76  #include "ExtendedValidation.h"
       
    77  #include "NSSCertDBTrustDomain.h"
    77  #include "mozilla/Telemetry.h"
    78  #include "mozilla/Telemetry.h"
    78  #include "nsCertVerificationThread.h"
    79  #include "nsCertVerificationThread.h"
    79  #include "nsAppDirectoryServiceDefs.h"
    80  #include "nsAppDirectoryServiceDefs.h"
    80  #include "nsComponentManagerUtils.h"
    81  #include "nsComponentManagerUtils.h"
    81  #include "nsDirectoryServiceDefs.h"
    82 @@ -1117,17 +1124,31 @@ nsNSSComponent::InitializeNSS()
    82 @@ -1207,18 +1214,35 @@ nsNSSComponent::InitializeNSS()
    83    if (NS_FAILED(rv)) {
    83      ConfigureInternalPKCS11Token();
    84      nsPSMInitPanic::SetPanic();
       
    85      return NS_ERROR_NOT_AVAILABLE;
       
    86    }
    84  
    87  
    85      // The NSS_INIT_NOROOTINIT flag turns off the loading of the root certs
    88    SECStatus init_rv = SECFailure;
    86      // module by NSS_Initialize because we will load it in InstallLoadableRoots
    89    if (!profileStr.IsEmpty()) {
    87      // later.  It also allows us to work around a bug in the system NSS in
    90      // First try to initialize the NSS DB in read/write mode.
    88      // Ubuntu 8.04, which loads any nonexistent "<configdir>/libnssckbi.so" as
    91 -    SECStatus init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false);
    89      // "/usr/lib/nss/libnssckbi.so".
       
    90      uint32_t init_flags = NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE;
       
    91 -    SECStatus init_rv = ::NSS_Initialize(profileStr.get(), "", "",
       
    92 -                                         SECMOD_DB, init_flags);
       
    93 +
       
    94 +    SECStatus init_rv = SECFailure;
       
    95 +#ifdef MOZ_ENABLE_NSSHELPER
    92 +#ifdef MOZ_ENABLE_NSSHELPER
    96 +    if (PR_GetEnv("MOZ_XRE_NO_NSSHELPER")) {
    93 +    if (PR_GetEnv("MOZ_XRE_NO_NSSHELPER")) {
    97 +      init_rv = ::NSS_Initialize(profileStr.get(), "", "",
    94 +      init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false);
    98 +                                 SECMOD_DB, init_flags);
       
    99 +    } else {
    95 +    } else {
   100 +      init_rv = ::nsshelp_open_db ("Firefox", profileStr.get(), init_flags);
    96 +      uint32_t flags = NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE;
       
    97 +      init_rv = ::nsshelp_open_db ("Firefox", profileStr.get(), flags);
   101 +
    98 +
   102 +      if (init_rv != SECSuccess) {
    99 +      if (init_rv != SECSuccess) {
   103 +        PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("can not init NSS using nsshelp_open_db in %s\n", profileStr.get()));
   100 +        PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("can not init NSS using nsshelp_open_db in %s\n", profileStr.get()));
   104 +        init_rv = ::NSS_Initialize(profileStr.get(), "", "",
   101 +        init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false);
   105 +                                   SECMOD_DB, init_flags);
       
   106 +      }
   102 +      }
   107 +    }
   103 +    }
   108 +#else
   104 +#else
   109 +    init_rv = ::NSS_Initialize(profileStr.get(), "", "",
   105 +    init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false);
   110 +                               SECMOD_DB, init_flags);
       
   111 +#endif
   106 +#endif
   112  
   107      // If that fails, attempt read-only mode.
   113      if (init_rv != SECSuccess) {
   108      if (init_rv != SECSuccess) {
   114        PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("can not init NSS r/w in %s\n", profileStr.get()));
   109        PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("could not init NSS r/w in %s\n", profileStr.get()));
   115  
   110        init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), true);
   116        // try to init r/o
   111      }
   117        init_flags |= NSS_INIT_READONLY;
   112      if (init_rv != SECSuccess) {
   118        init_rv = ::NSS_Initialize(profileStr.get(), "", "",
   113        PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("could not init in r/o either\n"));
   119                                   SECMOD_DB, init_flags);
   114      }
   120 diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in
   115 diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in
   121 --- a/toolkit/library/Makefile.in
   116 --- a/toolkit/library/Makefile.in
   122 +++ b/toolkit/library/Makefile.in
   117 +++ b/toolkit/library/Makefile.in
   123 @@ -245,17 +245,17 @@ endif
   118 @@ -223,17 +223,17 @@ endif
   124  ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
   119  ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
   125  SDK_LIBRARY = $(IMPORT_LIBRARY)
   120  SDK_LIBRARY = $(IMPORT_LIBRARY)
   126  else
   121  else
   127  SDK_LIBRARY = $(SHARED_LIBRARY)
   122  SDK_LIBRARY = $(SHARED_LIBRARY)
   128  endif
   123  endif