=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/openssl/s_client.c,v retrieving revision 1.49 retrieving revision 1.50 diff -c -r1.49 -r1.50 *** src/usr.bin/openssl/s_client.c 2020/07/09 14:09:19 1.49 --- src/usr.bin/openssl/s_client.c 2020/07/10 12:05:52 1.50 *************** *** 1,4 **** ! /* $OpenBSD: s_client.c,v 1.49 2020/07/09 14:09:19 inoguchi Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * --- 1,4 ---- ! /* $OpenBSD: s_client.c,v 1.50 2020/07/10 12:05:52 inoguchi Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * *************** *** 173,179 **** static void sc_usage(void); static void print_stuff(BIO * berr, SSL * con, int full); static int ocsp_resp_cb(SSL * s, void *arg); - static BIO *bio_c_out = NULL; enum { PROTO_OFF = 0, --- 173,178 ---- *************** *** 876,881 **** --- 875,881 ---- int write_tty, read_tty, write_ssl, read_ssl, tty_on, ssl_pending; SSL_CTX *ctx = NULL; int ret = 1, in_init = 1, i; + BIO *bio_c_out = NULL; BIO *sbio; int mbuf_len = 0; struct timeval timeout; *************** *** 961,974 **** goto end; } } ! if (bio_c_out == NULL) { ! if (s_client_config.quiet && !s_client_config.debug && ! !s_client_config.msg) { ! bio_c_out = BIO_new(BIO_s_null()); ! } else { ! if (bio_c_out == NULL) ! bio_c_out = BIO_new_fp(stdout, BIO_NOCLOSE); ! } } ctx = SSL_CTX_new(s_client_config.meth); --- 961,973 ---- goto end; } } ! if (s_client_config.quiet && !s_client_config.debug && ! !s_client_config.msg) { ! if ((bio_c_out = BIO_new(BIO_s_null())) == NULL) ! goto end; ! } else { ! if ((bio_c_out = BIO_new_fp(stdout, BIO_NOCLOSE)) == NULL) ! goto end; } ctx = SSL_CTX_new(s_client_config.meth); *************** *** 1621,1630 **** freezero(cbuf, BUFSIZZ); freezero(sbuf, BUFSIZZ); freezero(mbuf, BUFSIZZ); ! if (bio_c_out != NULL) { ! BIO_free(bio_c_out); ! bio_c_out = NULL; ! } return (ret); } --- 1620,1626 ---- freezero(cbuf, BUFSIZZ); freezero(sbuf, BUFSIZZ); freezero(mbuf, BUFSIZZ); ! BIO_free(bio_c_out); return (ret); } *************** *** 1757,1763 **** socklen_t ladd_size = sizeof(ladd); sock = SSL_get_fd(s); getsockname(sock, (struct sockaddr *) & ladd, &ladd_size); ! BIO_printf(bio_c_out, "LOCAL PORT is %u\n", ntohs(ladd.sin_port)); } #endif --- 1753,1759 ---- socklen_t ladd_size = sizeof(ladd); sock = SSL_get_fd(s); getsockname(sock, (struct sockaddr *) & ladd, &ladd_size); ! BIO_printf(bio, "LOCAL PORT is %u\n", ntohs(ladd.sin_port)); } #endif