OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 std::vector<SecCertificateRef> intermediate_ca_certs; | 453 std::vector<SecCertificateRef> intermediate_ca_certs; |
454 CFIndex certs_length = CFArrayGetCount(certs); | 454 CFIndex certs_length = CFArrayGetCount(certs); |
455 for (CFIndex i = 1; i < certs_length; ++i) { | 455 for (CFIndex i = 1; i < certs_length; ++i) { |
456 SecCertificateRef cert_ref = reinterpret_cast<SecCertificateRef>( | 456 SecCertificateRef cert_ref = reinterpret_cast<SecCertificateRef>( |
457 const_cast<void*>(CFArrayGetValueAtIndex(certs, i))); | 457 const_cast<void*>(CFArrayGetValueAtIndex(certs, i))); |
458 intermediate_ca_certs.push_back(cert_ref); | 458 intermediate_ca_certs.push_back(cert_ref); |
459 } | 459 } |
460 | 460 |
461 SecCertificateRef server_cert = static_cast<SecCertificateRef>( | 461 SecCertificateRef server_cert = static_cast<SecCertificateRef>( |
462 const_cast<void*>(CFArrayGetValueAtIndex(certs, 0))); | 462 const_cast<void*>(CFArrayGetValueAtIndex(certs, 0))); |
463 return X509Certificate::CreateFromHandle( | 463 return X509Certificate::CreateFromHandle(server_cert, |
464 server_cert, X509Certificate::SOURCE_FROM_NETWORK, intermediate_ca_certs); | 464 intermediate_ca_certs); |
465 } | 465 } |
466 | 466 |
467 // Dynamically look up a pointer to a function exported by a bundle. | 467 // Dynamically look up a pointer to a function exported by a bundle. |
468 template <typename FNTYPE> | 468 template <typename FNTYPE> |
469 FNTYPE LookupFunction(CFStringRef bundleName, CFStringRef fnName) { | 469 FNTYPE LookupFunction(CFStringRef bundleName, CFStringRef fnName) { |
470 CFBundleRef bundle = CFBundleGetBundleWithIdentifier(bundleName); | 470 CFBundleRef bundle = CFBundleGetBundleWithIdentifier(bundleName); |
471 if (!bundle) | 471 if (!bundle) |
472 return NULL; | 472 return NULL; |
473 return reinterpret_cast<FNTYPE>( | 473 return reinterpret_cast<FNTYPE>( |
474 CFBundleGetFunctionPointerForName(bundle, fnName)); | 474 CFBundleGetFunctionPointerForName(bundle, fnName)); |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 if (rv < 0 && rv != ERR_IO_PENDING) { | 1349 if (rv < 0 && rv != ERR_IO_PENDING) { |
1350 us->write_io_buf_ = NULL; | 1350 us->write_io_buf_ = NULL; |
1351 return OSStatusFromNetError(rv); | 1351 return OSStatusFromNetError(rv); |
1352 } | 1352 } |
1353 | 1353 |
1354 // always lie to our caller | 1354 // always lie to our caller |
1355 return noErr; | 1355 return noErr; |
1356 } | 1356 } |
1357 | 1357 |
1358 } // namespace net | 1358 } // namespace net |
OLD | NEW |