Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/nss_ssl_util.h" | 5 #include "net/socket/nss_ssl_util.h" |
| 6 | 6 |
| 7 #include <nss.h> | 7 #include <nss.h> |
| 8 #include <secerr.h> | 8 #include <secerr.h> |
| 9 #include <ssl.h> | 9 #include <ssl.h> |
| 10 #include <sslerr.h> | 10 #include <sslerr.h> |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 350 case SEC_ERROR_EXTRA_INPUT: | 350 case SEC_ERROR_EXTRA_INPUT: |
| 351 return ERR_SSL_BAD_PEER_PUBLIC_KEY; | 351 return ERR_SSL_BAD_PEER_PUBLIC_KEY; |
| 352 // During renegotiation, the server presented a different certificate than | 352 // During renegotiation, the server presented a different certificate than |
| 353 // was used earlier. | 353 // was used earlier. |
| 354 case SSL_ERROR_WRONG_CERTIFICATE: | 354 case SSL_ERROR_WRONG_CERTIFICATE: |
| 355 return ERR_SSL_SERVER_CERT_CHANGED; | 355 return ERR_SSL_SERVER_CERT_CHANGED; |
| 356 case SSL_ERROR_INAPPROPRIATE_FALLBACK_ALERT: | 356 case SSL_ERROR_INAPPROPRIATE_FALLBACK_ALERT: |
| 357 return ERR_SSL_INAPPROPRIATE_FALLBACK; | 357 return ERR_SSL_INAPPROPRIATE_FALLBACK; |
| 358 | 358 |
| 359 default: { | 359 default: { |
| 360 const char* pr_error = PR_ErrorToName(err); | |
|
wtc
2014/03/25 15:29:40
This variable should be named "err_name" because i
| |
| 361 if (pr_error == NULL) | |
| 362 pr_error = ""; | |
| 360 if (IS_SSL_ERROR(err)) { | 363 if (IS_SSL_ERROR(err)) { |
| 361 LOG(WARNING) << "Unknown SSL error " << err | 364 LOG(WARNING) << "Unknown SSL error " << err << " (" << pr_error << ")" |
| 362 << " mapped to net::ERR_SSL_PROTOCOL_ERROR"; | 365 << " mapped to net::ERR_SSL_PROTOCOL_ERROR"; |
| 363 return ERR_SSL_PROTOCOL_ERROR; | 366 return ERR_SSL_PROTOCOL_ERROR; |
| 364 } | 367 } |
| 365 LOG(WARNING) << "Unknown error " << err << " mapped to net::ERR_FAILED"; | 368 LOG(WARNING) << "Unknown error " << err << " (" << pr_error << ")" |
| 369 << " mapped to net::ERR_FAILED"; | |
| 366 return ERR_FAILED; | 370 return ERR_FAILED; |
| 367 } | 371 } |
| 368 } | 372 } |
| 369 } | 373 } |
| 370 | 374 |
| 371 // Returns parameters to attach to the NetLog when we receive an error in | 375 // Returns parameters to attach to the NetLog when we receive an error in |
| 372 // response to a call to an NSS function. Used instead of | 376 // response to a call to an NSS function. Used instead of |
| 373 // NetLogSSLErrorCallback with events of type TYPE_SSL_NSS_ERROR. | 377 // NetLogSSLErrorCallback with events of type TYPE_SSL_NSS_ERROR. |
| 374 base::Value* NetLogSSLFailedNSSFunctionCallback( | 378 base::Value* NetLogSSLFailedNSSFunctionCallback( |
| 375 const char* function, | 379 const char* function, |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 389 const char* param) { | 393 const char* param) { |
| 390 DCHECK(function); | 394 DCHECK(function); |
| 391 DCHECK(param); | 395 DCHECK(param); |
| 392 net_log.AddEvent( | 396 net_log.AddEvent( |
| 393 NetLog::TYPE_SSL_NSS_ERROR, | 397 NetLog::TYPE_SSL_NSS_ERROR, |
| 394 base::Bind(&NetLogSSLFailedNSSFunctionCallback, | 398 base::Bind(&NetLogSSLFailedNSSFunctionCallback, |
| 395 function, param, PR_GetError())); | 399 function, param, PR_GetError())); |
| 396 } | 400 } |
| 397 | 401 |
| 398 } // namespace net | 402 } // namespace net |
| OLD | NEW |