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

Side by Side Diff: net/socket/ssl_client_socket_mac.cc

Issue 2867026: Make X509Certificate::CreateFromHandle() copy the OSCertHandle, rather than assume ownership (Closed)
Patch Set: Deleted one comment too many Created 10 years, 6 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 unified diff | Download patch
« no previous file with comments | « net/base/x509_certificate_win.cc ('k') | net/socket/ssl_client_socket_nss.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 std::vector<SecCertificateRef> intermediate_ca_certs; 425 std::vector<SecCertificateRef> intermediate_ca_certs;
426 CFIndex certs_length = CFArrayGetCount(certs); 426 CFIndex certs_length = CFArrayGetCount(certs);
427 for (CFIndex i = 1; i < certs_length; ++i) { 427 for (CFIndex i = 1; i < certs_length; ++i) {
428 SecCertificateRef cert_ref = reinterpret_cast<SecCertificateRef>( 428 SecCertificateRef cert_ref = reinterpret_cast<SecCertificateRef>(
429 const_cast<void*>(CFArrayGetValueAtIndex(certs, i))); 429 const_cast<void*>(CFArrayGetValueAtIndex(certs, i)));
430 intermediate_ca_certs.push_back(cert_ref); 430 intermediate_ca_certs.push_back(cert_ref);
431 } 431 }
432 432
433 SecCertificateRef server_cert = static_cast<SecCertificateRef>( 433 SecCertificateRef server_cert = static_cast<SecCertificateRef>(
434 const_cast<void*>(CFArrayGetValueAtIndex(certs, 0))); 434 const_cast<void*>(CFArrayGetValueAtIndex(certs, 0)));
435 CFRetain(server_cert);
436 return X509Certificate::CreateFromHandle( 435 return X509Certificate::CreateFromHandle(
437 server_cert, X509Certificate::SOURCE_FROM_NETWORK, intermediate_ca_certs); 436 server_cert, X509Certificate::SOURCE_FROM_NETWORK, intermediate_ca_certs);
438 } 437 }
439 438
440 // Dynamically look up a pointer to a function exported by a bundle. 439 // Dynamically look up a pointer to a function exported by a bundle.
441 template <typename FNTYPE> 440 template <typename FNTYPE>
442 FNTYPE LookupFunction(CFStringRef bundleName, CFStringRef fnName) { 441 FNTYPE LookupFunction(CFStringRef bundleName, CFStringRef fnName) {
443 CFBundleRef bundle = CFBundleGetBundleWithIdentifier(bundleName); 442 CFBundleRef bundle = CFBundleGetBundleWithIdentifier(bundleName);
444 if (!bundle) 443 if (!bundle)
445 return NULL; 444 return NULL;
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 if (rv < 0 && rv != ERR_IO_PENDING) { 1292 if (rv < 0 && rv != ERR_IO_PENDING) {
1294 us->write_io_buf_ = NULL; 1293 us->write_io_buf_ = NULL;
1295 return OSStatusFromNetError(rv); 1294 return OSStatusFromNetError(rv);
1296 } 1295 }
1297 1296
1298 // always lie to our caller 1297 // always lie to our caller
1299 return noErr; 1298 return noErr;
1300 } 1299 }
1301 1300
1302 } // namespace net 1301 } // namespace net
OLDNEW
« no previous file with comments | « net/base/x509_certificate_win.cc ('k') | net/socket/ssl_client_socket_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698