summaryrefslogtreecommitdiff
path: root/lib/kx.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2016-06-06 18:43:12 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2016-06-06 18:46:43 +0200
commite9ed732affc0580ec0941178bf760a90e89c2201 (patch)
tree319061bd4972427dabb38b0d947683e287d4ae67 /lib/kx.c
parentff22daeca37be4c3c62e7095649243cb8d7a8454 (diff)
downloadgnutls-e9ed732affc0580ec0941178bf760a90e89c2201.tar.gz
keylogfile: only consider the SSLKEYLOGFILE variable
In addition do not check the environment in the constructor but instead use static variables to save the key file name. The GNUTLS_KEYLOGFILE environment variable is no longer used since there is no reason to have a separate one.
Diffstat (limited to 'lib/kx.c')
-rw-r--r--lib/kx.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/kx.c b/lib/kx.c
index 87a93f6906..4e0a50bd74 100644
--- a/lib/kx.c
+++ b/lib/kx.c
@@ -100,11 +100,18 @@ static void write_nss_key_log(gnutls_session_t session, const gnutls_datum_t *pr
char buf[512];
char buf2[512];
FILE *fp;
+ static const char *keylogfile = NULL;
+ static unsigned checked_env = 0;
- if (_gnutls_keylogfile == NULL)
+ if (!checked_env) {
+ checked_env = 1;
+ keylogfile = secure_getenv("SSLKEYLOGFILE");
+ }
+
+ if (keylogfile == NULL)
return;
- fp = fopen(_gnutls_keylogfile, "a");
+ fp = fopen(keylogfile, "a");
if (fp == NULL)
return;