Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Unified Diff: crypto/nss_util.cc

Issue 123633002: ChromeOS: Fix crash if login profile triggers client auth. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | crypto/nss_util_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/nss_util.cc
diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc
index 571ee1fdcbb5626af04ed1b8d6f74a8a94dd6a4d..76153a54a01647f83cb5f962a26ae2c7b0f29c0c 100644
--- a/crypto/nss_util.cc
+++ b/crypto/nss_util.cc
@@ -24,6 +24,7 @@
#include <map>
#include <vector>
+#include "base/bind.h"
#include "base/callback.h"
#include "base/cpu.h"
#include "base/debug/alias.h"
@@ -34,6 +35,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/native_library.h"
#include "base/stl_util.h"
@@ -444,6 +446,12 @@ class NSSInitSingleton {
ScopedPK11Slot GetPublicSlotForChromeOSUser(
const std::string& username_hash) {
DCHECK(thread_checker_.CalledOnValidThread());
+
+ if (username_hash.empty()) {
+ DVLOG(2) << "empty username_hash";
+ return ScopedPK11Slot();
+ }
+
if (test_slot_) {
DVLOG(2) << "returning test_slot_ for " << username_hash;
return ScopedPK11Slot(PK11_ReferenceSlot(test_slot_));
@@ -460,6 +468,16 @@ class NSSInitSingleton {
const std::string& username_hash,
const base::Callback<void(ScopedPK11Slot)>& callback) {
DCHECK(thread_checker_.CalledOnValidThread());
+
+ if (username_hash.empty()) {
+ DVLOG(2) << "empty username_hash";
+ if (!callback.is_null()) {
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE, base::Bind(callback, base::Passed(ScopedPK11Slot())));
+ }
+ return ScopedPK11Slot();
+ }
+
DCHECK(chromeos_user_map_.find(username_hash) != chromeos_user_map_.end());
if (test_slot_) {
« no previous file with comments | « no previous file | crypto/nss_util_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698