fix TLS key logging file entry corruption on non-Windows (#32266)
On Windows I see properly formatted key logging files that include CRLF, e.g.
CLIENT_RANDOM 1acfa70620279d4e2b2895fc510897db6b164be7c97b5e8ee2d3180a551d52ec 4214c5de0498316cedea48c767b97dcbc3cf8121c21b1c441026297796a8b96f502d06de280442b8232221f6be1fbf3a
However, on macOS and Linux see first 10 characters missing. Also there is no CR at the end of the line, e.g.
DOM 0d462bc4dd7884a8ef0d6f493de9a3d9622e88cd22e117f41eff6a833317cb99 aeac8859bdffc000d385b23a9dbec5a6397a7e27097399c23e838617d3a22da00bcf3722d543c93015bd117b11c8a413
This fix changes "\r\n" to "\n" which Wireshark appears to accept on both Windows and macOS.
<!--
If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.
If your pull request is for a specific language, please add the appropriate
lang label.
-->
Closes #32266
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/32266 from appneta:fix_unix_key_logging_file_corruption f0286f4124
PiperOrigin-RevId: 608748371
This commit is contained in:
parent
851b187d54
commit
fbbdda4e51
|
|
@ -83,7 +83,7 @@ void TlsSessionKeyLoggerCache::TlsSessionKeyLogger::LogSessionKeys(
|
|||
if (fd_ == nullptr || session_keys_info.empty()) return;
|
||||
// Append to key log file under lock
|
||||
bool err =
|
||||
fwrite((session_keys_info + "\r\n").c_str(), sizeof(char),
|
||||
fwrite((session_keys_info + "\n").c_str(), sizeof(char),
|
||||
session_keys_info.length() + 1, fd_) < session_keys_info.length();
|
||||
|
||||
if (err) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue