| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chromeos/network/client_cert_resolver.h" | 5 #include "chromeos/network/client_cert_resolver.h" |
| 6 | 6 |
| 7 #include <cert.h> | 7 #include <cert.h> |
| 8 #include <certt.h> // for (SECCertUsageEnum) certUsageAnyCA | 8 #include <certt.h> // for (SECCertUsageEnum) certUsageAnyCA |
| 9 #include <pk11pub.h> | 9 #include <pk11pub.h> |
| 10 | 10 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 net::ScopedCERTCertificate issuer_handle( | 144 net::ScopedCERTCertificate issuer_handle( |
| 145 CERT_FindCertIssuer(cert.os_cert_handle(), PR_Now(), certUsageAnyCA)); | 145 CERT_FindCertIssuer(cert.os_cert_handle(), PR_Now(), certUsageAnyCA)); |
| 146 if (!issuer_handle) { | 146 if (!issuer_handle) { |
| 147 LOG(ERROR) << "Couldn't find an issuer."; | 147 LOG(ERROR) << "Couldn't find an issuer."; |
| 148 continue; | 148 continue; |
| 149 } | 149 } |
| 150 scoped_refptr<net::X509Certificate> issuer = | 150 scoped_refptr<net::X509Certificate> issuer = |
| 151 net::X509Certificate::CreateFromHandle( | 151 net::X509Certificate::CreateFromHandle( |
| 152 issuer_handle.get(), | 152 issuer_handle.get(), |
| 153 net::X509Certificate::OSCertHandles() /* no intermediate certs */); | 153 net::X509Certificate::OSCertHandles() /* no intermediate certs */); |
| 154 if (!issuer) { | 154 if (!issuer.get()) { |
| 155 LOG(ERROR) << "Couldn't create issuer cert."; | 155 LOG(ERROR) << "Couldn't create issuer cert."; |
| 156 continue; | 156 continue; |
| 157 } | 157 } |
| 158 std::string pem_encoded_issuer; | 158 std::string pem_encoded_issuer; |
| 159 if (!net::X509Certificate::GetPEMEncoded(issuer->os_cert_handle(), | 159 if (!net::X509Certificate::GetPEMEncoded(issuer->os_cert_handle(), |
| 160 &pem_encoded_issuer)) { | 160 &pem_encoded_issuer)) { |
| 161 LOG(ERROR) << "Couldn't PEM-encode certificate."; | 161 LOG(ERROR) << "Couldn't PEM-encode certificate."; |
| 162 continue; | 162 continue; |
| 163 } | 163 } |
| 164 client_certs.push_back(CertAndIssuer(*it, pem_encoded_issuer)); | 164 client_certs.push_back(CertAndIssuer(*it, pem_encoded_issuer)); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 | 403 |
| 404 networks_with_pattern->push_back( | 404 networks_with_pattern->push_back( |
| 405 NetworkAndCertPattern(network->path(), cert_config)); | 405 NetworkAndCertPattern(network->path(), cert_config)); |
| 406 } | 406 } |
| 407 if (networks_with_pattern->empty()) | 407 if (networks_with_pattern->empty()) |
| 408 return; | 408 return; |
| 409 | 409 |
| 410 VLOG(2) << "Start task for resolving client cert patterns."; | 410 VLOG(2) << "Start task for resolving client cert patterns."; |
| 411 base::TaskRunner* task_runner = slow_task_runner_for_test_.get(); | 411 base::TaskRunner* task_runner = slow_task_runner_for_test_.get(); |
| 412 if (!task_runner) | 412 if (!task_runner) |
| 413 task_runner = base::WorkerPool::GetTaskRunner(true /* task is slow */); | 413 task_runner = |
| 414 base::WorkerPool::GetTaskRunner(true /* task is slow */).get(); |
| 414 | 415 |
| 415 NetworkCertMatches* matches = new NetworkCertMatches; | 416 NetworkCertMatches* matches = new NetworkCertMatches; |
| 416 task_runner->PostTaskAndReply( | 417 task_runner->PostTaskAndReply( |
| 417 FROM_HERE, | 418 FROM_HERE, |
| 418 base::Bind(&FindCertificateMatches, | 419 base::Bind(&FindCertificateMatches, |
| 419 CertLoader::Get()->cert_list(), | 420 CertLoader::Get()->cert_list(), |
| 420 base::Owned(networks_with_pattern.release()), | 421 base::Owned(networks_with_pattern.release()), |
| 421 matches), | 422 matches), |
| 422 base::Bind(&ClientCertResolver::ConfigureCertificates, | 423 base::Bind(&ClientCertResolver::ConfigureCertificates, |
| 423 weak_ptr_factory_.GetWeakPtr(), | 424 weak_ptr_factory_.GetWeakPtr(), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 441 DBusThreadManager::Get()->GetShillServiceClient()-> | 442 DBusThreadManager::Get()->GetShillServiceClient()-> |
| 442 SetProperties(dbus::ObjectPath(it->service_path), | 443 SetProperties(dbus::ObjectPath(it->service_path), |
| 443 shill_properties, | 444 shill_properties, |
| 444 base::Bind(&base::DoNothing), | 445 base::Bind(&base::DoNothing), |
| 445 base::Bind(&LogError, it->service_path)); | 446 base::Bind(&LogError, it->service_path)); |
| 446 network_state_handler_->RequestUpdateForNetwork(it->service_path); | 447 network_state_handler_->RequestUpdateForNetwork(it->service_path); |
| 447 } | 448 } |
| 448 } | 449 } |
| 449 | 450 |
| 450 } // namespace chromeos | 451 } // namespace chromeos |
| OLD | NEW |