| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/socket/ssl_client_socket_mac.h" | 5 #include "net/socket/ssl_client_socket_mac.h" |
| 6 | 6 |
| 7 #include <CoreServices/CoreServices.h> | 7 #include <CoreServices/CoreServices.h> |
| 8 #include <netdb.h> | 8 #include <netdb.h> |
| 9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 std::vector<SecCertificateRef> intermediate_ca_certs; | 431 std::vector<SecCertificateRef> intermediate_ca_certs; |
| 432 CFIndex certs_length = CFArrayGetCount(certs); | 432 CFIndex certs_length = CFArrayGetCount(certs); |
| 433 for (CFIndex i = 1; i < certs_length; ++i) { | 433 for (CFIndex i = 1; i < certs_length; ++i) { |
| 434 SecCertificateRef cert_ref = reinterpret_cast<SecCertificateRef>( | 434 SecCertificateRef cert_ref = reinterpret_cast<SecCertificateRef>( |
| 435 const_cast<void*>(CFArrayGetValueAtIndex(certs, i))); | 435 const_cast<void*>(CFArrayGetValueAtIndex(certs, i))); |
| 436 intermediate_ca_certs.push_back(cert_ref); | 436 intermediate_ca_certs.push_back(cert_ref); |
| 437 } | 437 } |
| 438 | 438 |
| 439 SecCertificateRef server_cert = static_cast<SecCertificateRef>( | 439 SecCertificateRef server_cert = static_cast<SecCertificateRef>( |
| 440 const_cast<void*>(CFArrayGetValueAtIndex(certs, 0))); | 440 const_cast<void*>(CFArrayGetValueAtIndex(certs, 0))); |
| 441 return X509Certificate::CreateFromHandle( | 441 return X509Certificate::CreateFromHandle(server_cert, |
| 442 server_cert, X509Certificate::SOURCE_FROM_NETWORK, intermediate_ca_certs); | 442 intermediate_ca_certs); |
| 443 } | 443 } |
| 444 | 444 |
| 445 // Dynamically look up a pointer to a function exported by a bundle. | 445 // Dynamically look up a pointer to a function exported by a bundle. |
| 446 template <typename FNTYPE> | 446 template <typename FNTYPE> |
| 447 FNTYPE LookupFunction(CFStringRef bundleName, CFStringRef fnName) { | 447 FNTYPE LookupFunction(CFStringRef bundleName, CFStringRef fnName) { |
| 448 CFBundleRef bundle = CFBundleGetBundleWithIdentifier(bundleName); | 448 CFBundleRef bundle = CFBundleGetBundleWithIdentifier(bundleName); |
| 449 if (!bundle) | 449 if (!bundle) |
| 450 return NULL; | 450 return NULL; |
| 451 return reinterpret_cast<FNTYPE>( | 451 return reinterpret_cast<FNTYPE>( |
| 452 CFBundleGetFunctionPointerForName(bundle, fnName)); | 452 CFBundleGetFunctionPointerForName(bundle, fnName)); |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 if (rv < 0 && rv != ERR_IO_PENDING) { | 1409 if (rv < 0 && rv != ERR_IO_PENDING) { |
| 1410 us->write_io_buf_ = NULL; | 1410 us->write_io_buf_ = NULL; |
| 1411 return OSStatusFromNetError(rv); | 1411 return OSStatusFromNetError(rv); |
| 1412 } | 1412 } |
| 1413 | 1413 |
| 1414 // always lie to our caller | 1414 // always lie to our caller |
| 1415 return noErr; | 1415 return noErr; |
| 1416 } | 1416 } |
| 1417 | 1417 |
| 1418 } // namespace net | 1418 } // namespace net |
| OLD | NEW |