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

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

Issue 502087: Use Separate SSL Session Cache in OTR Mode (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 5 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 | Annotate | Revision Log
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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 // resume a session, we must connect to the same server on the same port 803 // resume a session, we must connect to the same server on the same port
804 // using the same hostname (i.e., localhost and 127.0.0.1 are considered 804 // using the same hostname (i.e., localhost and 127.0.0.1 are considered
805 // different peers, which puts us through certificate validation again 805 // different peers, which puts us through certificate validation again
806 // and catches hostname/certificate name mismatches. 806 // and catches hostname/certificate name mismatches.
807 AddressList address; 807 AddressList address;
808 int rv = transport_->GetPeerAddress(&address); 808 int rv = transport_->GetPeerAddress(&address);
809 if (rv != OK) 809 if (rv != OK)
810 return rv; 810 return rv;
811 const struct addrinfo* ai = address.head(); 811 const struct addrinfo* ai = address.head();
812 std::string peer_id(hostname_); 812 std::string peer_id(hostname_);
813 // Unique session cache for OTR mode
814 if (ssl_config_.otr_mode)
815 peer_id += std::string("OTR");
davidben 2010/07/26 21:31:33 Unless hostname also includes the port (and even t
813 peer_id += std::string(reinterpret_cast<char*>(ai->ai_addr), 816 peer_id += std::string(reinterpret_cast<char*>(ai->ai_addr),
814 ai->ai_addrlen); 817 ai->ai_addrlen);
815 818
816 // SSLSetPeerID() treats peer_id as a binary blob, and makes its 819 // SSLSetPeerID() treats peer_id as a binary blob, and makes its
817 // own copy. 820 // own copy.
818 status = SSLSetPeerID(ssl_context_, peer_id.data(), peer_id.length()); 821 status = SSLSetPeerID(ssl_context_, peer_id.data(), peer_id.length());
819 if (status) 822 if (status)
820 return NetErrorFromOSStatus(status); 823 return NetErrorFromOSStatus(status);
821 } else if (status != unimpErr) { // it's OK if the API isn't available 824 } else if (status != unimpErr) { // it's OK if the API isn't available
822 return NetErrorFromOSStatus(status); 825 return NetErrorFromOSStatus(status);
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 if (rv < 0 && rv != ERR_IO_PENDING) { 1295 if (rv < 0 && rv != ERR_IO_PENDING) {
1293 us->write_io_buf_ = NULL; 1296 us->write_io_buf_ = NULL;
1294 return OSStatusFromNetError(rv); 1297 return OSStatusFromNetError(rv);
1295 } 1298 }
1296 1299
1297 // always lie to our caller 1300 // always lie to our caller
1298 return noErr; 1301 return noErr;
1299 } 1302 }
1300 1303
1301 } // namespace net 1304 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698