Bug 810579: Fix crash when an SSL key-log file couldn't be opened. The

patch is contributed by Adam Langley <agl@chromium.org>. r=rsleevi,wtc.


git-svn-id: svn://10.0.0.236/trunk@264415 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
wtc%google.com
2012-11-10 12:17:44 +00:00
parent e7bc23dd0f
commit f071981d14

View File

@@ -6,7 +6,7 @@
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* $Id: sslsock.c,v 1.96 2012-09-24 23:57:42 wtc%google.com Exp $ */
/* $Id: sslsock.c,v 1.97 2012-11-10 12:17:44 wtc%google.com Exp $ */
#include "seccomon.h"
#include "cert.h"
#include "keyhi.h"
@@ -2792,11 +2792,15 @@ ssl_SetDefaultsFromEnvironment(void)
ev = getenv("SSLKEYLOGFILE");
if (ev && ev[0]) {
ssl_keylog_iob = fopen(ev, "a");
if (ftell(ssl_keylog_iob) == 0) {
fputs("# SSL/TLS secrets log file, generated by NSS\n",
ssl_keylog_iob);
if (!ssl_keylog_iob) {
SSL_TRACE(("SSL: failed to open key log file"));
} else {
if (ftell(ssl_keylog_iob) == 0) {
fputs("# SSL/TLS secrets log file, generated by NSS\n",
ssl_keylog_iob);
}
SSL_TRACE(("SSL: logging SSL/TLS secrets to %s", ev));
}
SSL_TRACE(("SSL: logging SSL/TLS secrets to %s", ev));
}
#ifndef NO_PKCS11_BYPASS
ev = getenv("SSLBYPASS");