| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 // This file includes code GetDefaultCertNickname(), derived from | 5 // This file includes code GetDefaultCertNickname(), derived from |
| 6 // nsNSSCertificate::defaultServerNickName() | 6 // nsNSSCertificate::defaultServerNickName() |
| 7 // in mozilla/security/manager/ssl/src/nsNSSCertificate.cpp | 7 // in mozilla/security/manager/ssl/src/nsNSSCertificate.cpp |
| 8 // and SSLClientSocketNSS::DoVerifyCertComplete() derived from | 8 // and SSLClientSocketNSS::DoVerifyCertComplete() derived from |
| 9 // AuthCertificateCallback() in | 9 // AuthCertificateCallback() in |
| 10 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. | 10 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 if (rv >= 0) { | 949 if (rv >= 0) { |
| 950 LogData(user_read_buf_->data(), rv); | 950 LogData(user_read_buf_->data(), rv); |
| 951 LeaveFunction(""); | 951 LeaveFunction(""); |
| 952 return rv; | 952 return rv; |
| 953 } | 953 } |
| 954 PRErrorCode prerr = PR_GetError(); | 954 PRErrorCode prerr = PR_GetError(); |
| 955 if (prerr == PR_WOULD_BLOCK_ERROR) { | 955 if (prerr == PR_WOULD_BLOCK_ERROR) { |
| 956 LeaveFunction(""); | 956 LeaveFunction(""); |
| 957 return ERR_IO_PENDING; | 957 return ERR_IO_PENDING; |
| 958 } | 958 } |
| 959 int net_error; |
| 960 if (prerr == PR_END_OF_FILE_ERROR) { |
| 961 // TODO(wtc): Unless we have received the close_notify alert, we need to |
| 962 // return an error code indicating that the SSL connection ended |
| 963 // uncleanly, a potential truncation attack. See http://crbug.com/18586. |
| 964 LOG(WARNING) << "SSL connection closed without close_notify"; |
| 965 LogData(user_read_buf_->data(), 0); |
| 966 net_error = 0; |
| 967 } else { |
| 968 net_error = NetErrorFromNSPRError(prerr); |
| 969 } |
| 959 LeaveFunction(""); | 970 LeaveFunction(""); |
| 960 return NetErrorFromNSPRError(prerr); | 971 return net_error; |
| 961 } | 972 } |
| 962 | 973 |
| 963 int SSLClientSocketNSS::DoPayloadWrite() { | 974 int SSLClientSocketNSS::DoPayloadWrite() { |
| 964 EnterFunction(user_write_buf_len_); | 975 EnterFunction(user_write_buf_len_); |
| 965 DCHECK(user_write_buf_); | 976 DCHECK(user_write_buf_); |
| 966 int rv = PR_Write(nss_fd_, user_write_buf_->data(), user_write_buf_len_); | 977 int rv = PR_Write(nss_fd_, user_write_buf_->data(), user_write_buf_len_); |
| 967 if (rv >= 0) { | 978 if (rv >= 0) { |
| 968 LogData(user_write_buf_->data(), rv); | 979 LogData(user_write_buf_->data(), rv); |
| 969 LeaveFunction(""); | 980 LeaveFunction(""); |
| 970 return rv; | 981 return rv; |
| 971 } | 982 } |
| 972 PRErrorCode prerr = PR_GetError(); | 983 PRErrorCode prerr = PR_GetError(); |
| 973 if (prerr == PR_WOULD_BLOCK_ERROR) { | 984 if (prerr == PR_WOULD_BLOCK_ERROR) { |
| 974 return ERR_IO_PENDING; | 985 return ERR_IO_PENDING; |
| 975 } | 986 } |
| 976 LeaveFunction(""); | 987 LeaveFunction(""); |
| 977 return NetErrorFromNSPRError(prerr); | 988 return NetErrorFromNSPRError(prerr); |
| 978 } | 989 } |
| 979 | 990 |
| 980 } // namespace net | 991 } // namespace net |
| OLD | NEW |