OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/cert/nss_cert_database.h" | 5 #include "net/cert/nss_cert_database.h" |
6 | 6 |
7 #include <cert.h> | 7 #include <cert.h> |
8 #include <certdb.h> | 8 #include <certdb.h> |
9 #include <keyhi.h> | 9 #include <keyhi.h> |
10 #include <pk11pub.h> | 10 #include <pk11pub.h> |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 | 413 |
414 CERTCertList* cert_list = NULL; | 414 CERTCertList* cert_list = NULL; |
415 if (slot) | 415 if (slot) |
416 cert_list = PK11_ListCertsInSlot(slot.get()); | 416 cert_list = PK11_ListCertsInSlot(slot.get()); |
417 else | 417 else |
418 cert_list = PK11_ListCerts(PK11CertListUnique, NULL); | 418 cert_list = PK11_ListCerts(PK11CertListUnique, NULL); |
419 | 419 |
420 CERTCertListNode* node; | 420 CERTCertListNode* node; |
421 for (node = CERT_LIST_HEAD(cert_list); !CERT_LIST_END(node, cert_list); | 421 for (node = CERT_LIST_HEAD(cert_list); !CERT_LIST_END(node, cert_list); |
422 node = CERT_LIST_NEXT(node)) { | 422 node = CERT_LIST_NEXT(node)) { |
423 certs->push_back(X509Certificate::CreateFromHandle( | 423 scoped_refptr<X509Certificate> cert = X509Certificate::CreateFromHandle( |
424 node->cert, X509Certificate::OSCertHandles())); | 424 node->cert, X509Certificate::OSCertHandles()); |
| 425 if (!cert) { |
| 426 LOG(ERROR) << "X509Certificate::CreateFromHandle failed"; |
| 427 continue; |
| 428 } |
| 429 certs->push_back(cert); |
425 } | 430 } |
426 CERT_DestroyCertList(cert_list); | 431 CERT_DestroyCertList(cert_list); |
427 } | 432 } |
428 | 433 |
429 scoped_refptr<base::TaskRunner> NSSCertDatabase::GetSlowTaskRunner() const { | 434 scoped_refptr<base::TaskRunner> NSSCertDatabase::GetSlowTaskRunner() const { |
430 if (slow_task_runner_for_test_.get()) | 435 if (slow_task_runner_for_test_.get()) |
431 return slow_task_runner_for_test_; | 436 return slow_task_runner_for_test_; |
432 return base::WorkerPool::GetTaskRunner(true /*task is slow*/); | 437 return base::WorkerPool::GetTaskRunner(true /*task is slow*/); |
433 } | 438 } |
434 | 439 |
(...skipping 27 matching lines...) Expand all Loading... |
462 } else { | 467 } else { |
463 if (SEC_DeletePermCertificate(cert->os_cert_handle())) { | 468 if (SEC_DeletePermCertificate(cert->os_cert_handle())) { |
464 LOG(ERROR) << "SEC_DeletePermCertificate failed: " << PORT_GetError(); | 469 LOG(ERROR) << "SEC_DeletePermCertificate failed: " << PORT_GetError(); |
465 return false; | 470 return false; |
466 } | 471 } |
467 } | 472 } |
468 return true; | 473 return true; |
469 } | 474 } |
470 | 475 |
471 } // namespace net | 476 } // namespace net |
OLD | NEW |