Chromium Code Reviews

Side by Side Diff: base/nss_util.cc

Issue 1545034: Do not call NSS functions if NSS initialization failed.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
« no previous file with comments | « no previous file | net/base/x509_certificate_nss.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 113 matching lines...)
124 << "): NSS error code " << PR_GetError(); 124 << "): NSS error code " << PR_GetError();
125 } 125 }
126 } 126 }
127 if (status != SECSuccess) { 127 if (status != SECSuccess) {
128 LOG(WARNING) << "Initialize NSS without a persistent database " 128 LOG(WARNING) << "Initialize NSS without a persistent database "
129 "(~/.pki/nssdb)."; 129 "(~/.pki/nssdb).";
130 status = NSS_NoDB_Init(NULL); 130 status = NSS_NoDB_Init(NULL);
131 if (status != SECSuccess) { 131 if (status != SECSuccess) {
132 LOG(ERROR) << "Error initializing NSS without a persistent " 132 LOG(ERROR) << "Error initializing NSS without a persistent "
133 "database: NSS error code " << PR_GetError(); 133 "database: NSS error code " << PR_GetError();
134 return;
134 } 135 }
135 } 136 }
136 137
137 // If we haven't initialized the password for the NSS databases, 138 // If we haven't initialized the password for the NSS databases,
138 // initialize an empty-string password so that we don't need to 139 // initialize an empty-string password so that we don't need to
139 // log in. 140 // log in.
140 PK11SlotInfo* slot = PK11_GetInternalKeySlot(); 141 PK11SlotInfo* slot = PK11_GetInternalKeySlot();
141 if (slot) { 142 if (slot) {
142 if (PK11_NeedUserInit(slot)) 143 if (PK11_NeedUserInit(slot))
143 PK11_InitPin(slot, NULL, NULL); 144 PK11_InitPin(slot, NULL, NULL);
(...skipping 49 matching lines...)
193 exploded.day_of_month = prxtime.tm_mday; 194 exploded.day_of_month = prxtime.tm_mday;
194 exploded.hour = prxtime.tm_hour; 195 exploded.hour = prxtime.tm_hour;
195 exploded.minute = prxtime.tm_min; 196 exploded.minute = prxtime.tm_min;
196 exploded.second = prxtime.tm_sec; 197 exploded.second = prxtime.tm_sec;
197 exploded.millisecond = prxtime.tm_usec / 1000; 198 exploded.millisecond = prxtime.tm_usec / 1000;
198 199
199 return Time::FromUTCExploded(exploded); 200 return Time::FromUTCExploded(exploded);
200 } 201 }
201 202
202 } // namespace base 203 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | net/base/x509_certificate_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine