| OLD | NEW |
| 1 // Copyright (c) 2008-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008-2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/nss_util.h" | 5 #include "base/nss_util.h" |
| 6 | 6 |
| 7 #include <nss.h> | 7 #include <nss.h> |
| 8 #include <plarena.h> | 8 #include <plarena.h> |
| 9 #include <prerror.h> | 9 #include <prerror.h> |
| 10 #include <prinit.h> | 10 #include <prinit.h> |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 base::EnsureNSPRInit(); | 82 base::EnsureNSPRInit(); |
| 83 | 83 |
| 84 // We *must* have NSS >= 3.12.3. See bug 26448. | 84 // We *must* have NSS >= 3.12.3. See bug 26448. |
| 85 COMPILE_ASSERT( | 85 COMPILE_ASSERT( |
| 86 (NSS_VMAJOR == 3 && NSS_VMINOR == 12 && NSS_VPATCH >= 3) || | 86 (NSS_VMAJOR == 3 && NSS_VMINOR == 12 && NSS_VPATCH >= 3) || |
| 87 (NSS_VMAJOR == 3 && NSS_VMINOR > 12) || | 87 (NSS_VMAJOR == 3 && NSS_VMINOR > 12) || |
| 88 (NSS_VMAJOR > 3), | 88 (NSS_VMAJOR > 3), |
| 89 nss_version_check_failed); | 89 nss_version_check_failed); |
| 90 // Also check the run-time NSS version. | 90 // Also check the run-time NSS version. |
| 91 // NSS_VersionCheck is a >= check, not strict equality. | 91 // NSS_VersionCheck is a >= check, not strict equality. |
| 92 CHECK(NSS_VersionCheck("3.12.3")) << "We depend on NSS >= 3.12.3. " | 92 if (!NSS_VersionCheck("3.12.3")) { |
| 93 "If NSS is up to date, please " | 93 // It turns out many people have misconfigured NSS setups, where |
| 94 "update NSPR to the latest version."; | 94 // their run-time NSPR doesn't match the one their NSS was compiled |
| 95 // against. So rather than aborting, complain loudly. |
| 96 LOG(ERROR) << "NSS_VersionCheck(\"3.12.3\") failed. " |
| 97 "We depend on NSS >= 3.12.3, and this error is not fatal " |
| 98 "only because many people have busted NSS setups (for " |
| 99 "example, using the wrong version of NSPR). " |
| 100 "Please upgrade to the latest NSS and NSPR, and if you " |
| 101 "still get this error, contact your distribution " |
| 102 "maintainer."; |
| 103 } |
| 95 | 104 |
| 96 SECStatus status = SECFailure; | 105 SECStatus status = SECFailure; |
| 97 #if defined(USE_NSS_FOR_SSL_ONLY) | 106 #if defined(USE_NSS_FOR_SSL_ONLY) |
| 98 // Use the system certificate store, so initialize NSS without database. | 107 // Use the system certificate store, so initialize NSS without database. |
| 99 status = NSS_NoDB_Init(NULL); | 108 status = NSS_NoDB_Init(NULL); |
| 100 if (status != SECSuccess) { | 109 if (status != SECSuccess) { |
| 101 LOG(ERROR) << "Error initializing NSS without a persistent " | 110 LOG(ERROR) << "Error initializing NSS without a persistent " |
| 102 "database: NSS error code " << PR_GetError(); | 111 "database: NSS error code " << PR_GetError(); |
| 103 } | 112 } |
| 104 #else | 113 #else |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 exploded.day_of_month = prxtime.tm_mday; | 193 exploded.day_of_month = prxtime.tm_mday; |
| 185 exploded.hour = prxtime.tm_hour; | 194 exploded.hour = prxtime.tm_hour; |
| 186 exploded.minute = prxtime.tm_min; | 195 exploded.minute = prxtime.tm_min; |
| 187 exploded.second = prxtime.tm_sec; | 196 exploded.second = prxtime.tm_sec; |
| 188 exploded.millisecond = prxtime.tm_usec / 1000; | 197 exploded.millisecond = prxtime.tm_usec / 1000; |
| 189 | 198 |
| 190 return Time::FromUTCExploded(exploded); | 199 return Time::FromUTCExploded(exploded); |
| 191 } | 200 } |
| 192 | 201 |
| 193 } // namespace base | 202 } // namespace base |
| OLD | NEW |