diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/usr.bin/openssl/s_client.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/usr.bin/openssl/s_client.c b/src/usr.bin/openssl/s_client.c index c32c3c3987..54fcc75bb4 100644 --- a/src/usr.bin/openssl/s_client.c +++ b/src/usr.bin/openssl/s_client.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s_client.c,v 1.49 2020/07/09 14:09:19 inoguchi Exp $ */ | 1 | /* $OpenBSD: s_client.c,v 1.50 2020/07/10 12:05:52 inoguchi Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -173,7 +173,6 @@ | |||
173 | static void sc_usage(void); | 173 | static void sc_usage(void); |
174 | static void print_stuff(BIO * berr, SSL * con, int full); | 174 | static void print_stuff(BIO * berr, SSL * con, int full); |
175 | static int ocsp_resp_cb(SSL * s, void *arg); | 175 | static int ocsp_resp_cb(SSL * s, void *arg); |
176 | static BIO *bio_c_out = NULL; | ||
177 | 176 | ||
178 | enum { | 177 | enum { |
179 | PROTO_OFF = 0, | 178 | PROTO_OFF = 0, |
@@ -876,6 +875,7 @@ s_client_main(int argc, char **argv) | |||
876 | int write_tty, read_tty, write_ssl, read_ssl, tty_on, ssl_pending; | 875 | int write_tty, read_tty, write_ssl, read_ssl, tty_on, ssl_pending; |
877 | SSL_CTX *ctx = NULL; | 876 | SSL_CTX *ctx = NULL; |
878 | int ret = 1, in_init = 1, i; | 877 | int ret = 1, in_init = 1, i; |
878 | BIO *bio_c_out = NULL; | ||
879 | BIO *sbio; | 879 | BIO *sbio; |
880 | int mbuf_len = 0; | 880 | int mbuf_len = 0; |
881 | struct timeval timeout; | 881 | struct timeval timeout; |
@@ -961,14 +961,13 @@ s_client_main(int argc, char **argv) | |||
961 | goto end; | 961 | goto end; |
962 | } | 962 | } |
963 | } | 963 | } |
964 | if (bio_c_out == NULL) { | 964 | if (s_client_config.quiet && !s_client_config.debug && |
965 | if (s_client_config.quiet && !s_client_config.debug && | 965 | !s_client_config.msg) { |
966 | !s_client_config.msg) { | 966 | if ((bio_c_out = BIO_new(BIO_s_null())) == NULL) |
967 | bio_c_out = BIO_new(BIO_s_null()); | 967 | goto end; |
968 | } else { | 968 | } else { |
969 | if (bio_c_out == NULL) | 969 | if ((bio_c_out = BIO_new_fp(stdout, BIO_NOCLOSE)) == NULL) |
970 | bio_c_out = BIO_new_fp(stdout, BIO_NOCLOSE); | 970 | goto end; |
971 | } | ||
972 | } | 971 | } |
973 | 972 | ||
974 | ctx = SSL_CTX_new(s_client_config.meth); | 973 | ctx = SSL_CTX_new(s_client_config.meth); |
@@ -1621,10 +1620,7 @@ s_client_main(int argc, char **argv) | |||
1621 | freezero(cbuf, BUFSIZZ); | 1620 | freezero(cbuf, BUFSIZZ); |
1622 | freezero(sbuf, BUFSIZZ); | 1621 | freezero(sbuf, BUFSIZZ); |
1623 | freezero(mbuf, BUFSIZZ); | 1622 | freezero(mbuf, BUFSIZZ); |
1624 | if (bio_c_out != NULL) { | 1623 | BIO_free(bio_c_out); |
1625 | BIO_free(bio_c_out); | ||
1626 | bio_c_out = NULL; | ||
1627 | } | ||
1628 | 1624 | ||
1629 | return (ret); | 1625 | return (ret); |
1630 | } | 1626 | } |
@@ -1757,7 +1753,7 @@ print_stuff(BIO * bio, SSL * s, int full) | |||
1757 | socklen_t ladd_size = sizeof(ladd); | 1753 | socklen_t ladd_size = sizeof(ladd); |
1758 | sock = SSL_get_fd(s); | 1754 | sock = SSL_get_fd(s); |
1759 | getsockname(sock, (struct sockaddr *) & ladd, &ladd_size); | 1755 | getsockname(sock, (struct sockaddr *) & ladd, &ladd_size); |
1760 | BIO_printf(bio_c_out, "LOCAL PORT is %u\n", | 1756 | BIO_printf(bio, "LOCAL PORT is %u\n", |
1761 | ntohs(ladd.sin_port)); | 1757 | ntohs(ladd.sin_port)); |
1762 | } | 1758 | } |
1763 | #endif | 1759 | #endif |