From: Nikos Mavrogiannopoulos Date: Fri, 27 May 2016 20:34:53 +0000 (+0200) Subject: tests: keylog-env will check for SSLKEYLOGFILE as well X-Git-Tag: gnutls_3_5_1~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcf90a9b9718f369ee114233e94c2f2129e231cc;p=thirdparty%2Fgnutls.git tests: keylog-env will check for SSLKEYLOGFILE as well --- diff --git a/tests/keylog-env.c b/tests/keylog-env.c index 2e2c7ea62c..666c61ace4 100644 --- a/tests/keylog-env.c +++ b/tests/keylog-env.c @@ -70,19 +70,25 @@ static void search_for_str(const char *filename) fail("file did not contain CLIENT_RANDOM\n"); } -void doit(void) +static void run(const char *env, const char *filename) { gnutls_certificate_credentials_t x509_cred; int ret; - char filename[TMPNAME_SIZE]; - - /* this must be called once in the program - */ - global_init(); - assert(get_tmpname(filename)!=NULL); remove(filename); +#ifdef _WIN32 + { + char buf[512]; + snprintf(buf, sizeof(buf), "%s=%s", env, filename); + _putenv(buf); + } +#else + setenv(env, filename, 1); +#endif + + global_init(); + if (debug) { gnutls_global_set_log_level(6); gnutls_global_set_log_function(tls_log_func); @@ -99,15 +105,6 @@ void doit(void) exit(1); } -#ifdef _WIN32 - { - char buf[512]; - snprintf(buf, sizeof(buf), "GNUTLS_KEYLOGFILE=%s", filename); - _putenv(buf); - } -#else - setenv("GNUTLS_KEYLOGFILE", filename, 1); -#endif test_cli_serv(x509_cred, "NORMAL", &ca3_cert, "localhost"); if (access(filename, R_OK) != 0) { @@ -125,3 +122,14 @@ void doit(void) if (debug) success("success"); } + +void doit(void) +{ + char filename[TMPNAME_SIZE]; + + assert(get_tmpname(filename)!=NULL); + + gnutls_global_deinit(); + run("GNUTLS_KEYLOGFILE", filename); + run("SSLKEYLOGFILE", filename); +}