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

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

Issue 515049: Changed catch-all Mac SSL OSStatus error to paramErr (Closed)
Patch Set: Added needed incldue. Created 10 years, 11 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 | « no previous file | no next file » | 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) 2008-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008-2009 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>
8
7 #include "base/scoped_cftyperef.h" 9 #include "base/scoped_cftyperef.h"
8 #include "base/singleton.h" 10 #include "base/singleton.h"
9 #include "base/string_util.h" 11 #include "base/string_util.h"
10 #include "net/base/cert_verifier.h" 12 #include "net/base/cert_verifier.h"
11 #include "net/base/io_buffer.h" 13 #include "net/base/io_buffer.h"
12 #include "net/base/load_log.h" 14 #include "net/base/load_log.h"
13 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
14 #include "net/base/ssl_info.h" 16 #include "net/base/ssl_info.h"
15 17
16 // Welcome to Mac SSL. We've been waiting for you. 18 // Welcome to Mac SSL. We've been waiting for you.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 case errSSLWouldBlock: 113 case errSSLWouldBlock:
112 return ERR_IO_PENDING; 114 return ERR_IO_PENDING;
113 case errSSLBadCipherSuite: 115 case errSSLBadCipherSuite:
114 case errSSLBadConfiguration: 116 case errSSLBadConfiguration:
115 return ERR_INVALID_ARGUMENT; 117 return ERR_INVALID_ARGUMENT;
116 case errSSLClosedNoNotify: 118 case errSSLClosedNoNotify:
117 return ERR_CONNECTION_RESET; 119 return ERR_CONNECTION_RESET;
118 case errSSLClosedAbort: 120 case errSSLClosedAbort:
119 return ERR_CONNECTION_ABORTED; 121 return ERR_CONNECTION_ABORTED;
120 case errSSLInternal: 122 case errSSLInternal:
123 return ERR_UNEXPECTED;
121 case errSSLCrypto: 124 case errSSLCrypto:
122 case errSSLFatalAlert: 125 case errSSLFatalAlert:
123 case errSSLIllegalParam: // Received an illegal_parameter alert. 126 case errSSLIllegalParam: // Received an illegal_parameter alert.
124 case errSSLPeerUnexpectedMsg: // Received an unexpected_message alert. 127 case errSSLPeerUnexpectedMsg: // Received an unexpected_message alert.
125 case errSSLProtocol: 128 case errSSLProtocol:
126 case errSSLPeerHandshakeFail: // Received a handshake_failure alert. 129 case errSSLPeerHandshakeFail: // Received a handshake_failure alert.
127 case errSSLConnectionRefused: 130 case errSSLConnectionRefused:
128 return ERR_SSL_PROTOCOL_ERROR; 131 return ERR_SSL_PROTOCOL_ERROR;
129 case errSSLHostNameMismatch: 132 case errSSLHostNameMismatch:
130 return ERR_CERT_COMMON_NAME_INVALID; 133 return ERR_CERT_COMMON_NAME_INVALID;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 case ERR_IO_PENDING: 166 case ERR_IO_PENDING:
164 return errSSLWouldBlock; 167 return errSSLWouldBlock;
165 case ERR_INTERNET_DISCONNECTED: 168 case ERR_INTERNET_DISCONNECTED:
166 case ERR_TIMED_OUT: 169 case ERR_TIMED_OUT:
167 case ERR_CONNECTION_ABORTED: 170 case ERR_CONNECTION_ABORTED:
168 case ERR_CONNECTION_RESET: 171 case ERR_CONNECTION_RESET:
169 case ERR_CONNECTION_REFUSED: 172 case ERR_CONNECTION_REFUSED:
170 case ERR_ADDRESS_UNREACHABLE: 173 case ERR_ADDRESS_UNREACHABLE:
171 case ERR_ADDRESS_INVALID: 174 case ERR_ADDRESS_INVALID:
172 return errSSLClosedAbort; 175 return errSSLClosedAbort;
176 case ERR_UNEXPECTED:
177 return errSSLInternal;
178 case ERR_INVALID_ARGUMENT:
179 return paramErr;
173 case OK: 180 case OK:
174 return noErr; 181 return noErr;
175 default: 182 default:
176 LOG(WARNING) << "Unknown error " << net_error << 183 LOG(WARNING) << "Unknown error " << net_error <<
177 " mapped to errSSLIllegalParam"; 184 " mapped to paramErr";
178 return errSSLIllegalParam; 185 return paramErr;
179 } 186 }
180 } 187 }
181 188
182 // Converts from a cipher suite to its key size. If the suite is marked with a 189 // Converts from a cipher suite to its key size. If the suite is marked with a
183 // **, it's not actually implemented in Secure Transport and won't be returned 190 // **, it's not actually implemented in Secure Transport and won't be returned
184 // (but we'll code for it anyway). The reference here is 191 // (but we'll code for it anyway). The reference here is
185 // http://www.opensource.apple.com/darwinsource/10.5.5/libsecurity_ssl-32463/lib /cipherSpecs.c 192 // http://www.opensource.apple.com/darwinsource/10.5.5/libsecurity_ssl-32463/lib /cipherSpecs.c
186 // Seriously, though, there has to be an API for this, but I can't find one. 193 // Seriously, though, there has to be an API for this, but I can't find one.
187 // Anybody? 194 // Anybody?
188 int KeySizeOfCipherSuite(SSLCipherSuite suite) { 195 int KeySizeOfCipherSuite(SSLCipherSuite suite) {
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 if (rv < 0 && rv != ERR_IO_PENDING) { 923 if (rv < 0 && rv != ERR_IO_PENDING) {
917 us->write_io_buf_ = NULL; 924 us->write_io_buf_ = NULL;
918 return OSStatusFromNetError(rv); 925 return OSStatusFromNetError(rv);
919 } 926 }
920 927
921 // always lie to our caller 928 // always lie to our caller
922 return noErr; 929 return noErr;
923 } 930 }
924 931
925 } // namespace net 932 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698