=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/openssl/s_client.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- src/usr.bin/openssl/s_client.c 2020/01/22 04:51:48 1.39 +++ src/usr.bin/openssl/s_client.c 2020/01/22 06:40:42 1.40 @@ -1,4 +1,4 @@ -/* $OpenBSD: s_client.c,v 1.39 2020/01/22 04:51:48 beck Exp $ */ +/* $OpenBSD: s_client.c,v 1.40 2020/01/22 06:40:42 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1122,47 +1122,18 @@ } #endif if (peekaboo) { - p = SSL_peek(con, pbuf, 1024 /* BUFSIZZ */ ); - - switch (SSL_get_error(con, k)) { - case SSL_ERROR_NONE: + k = p = SSL_peek(con, pbuf, 1024 /* BUFSIZZ */ ); + if (SSL_get_error(con, p) == SSL_ERROR_NONE) { if (p <= 0) goto end; pbuf_off = 0; pbuf_len = p; - break; - case SSL_ERROR_WANT_WRITE: - BIO_printf(bio_c_out, "peek W BLOCK\n"); - write_ssl = 1; - read_tty = 0; - break; - case SSL_ERROR_WANT_READ: - BIO_printf(bio_c_out, "peek R BLOCK\n"); - write_tty = 0; - read_ssl = 1; - if ((read_tty == 0) && (write_ssl == 0)) - write_ssl = 1; - break; - case SSL_ERROR_WANT_X509_LOOKUP: - BIO_printf(bio_c_out, "peek X BLOCK\n"); - break; - case SSL_ERROR_SYSCALL: - ret = errno; - BIO_printf(bio_err, "peek:errno=%d\n", ret); - goto shut; - case SSL_ERROR_ZERO_RETURN: - BIO_printf(bio_c_out, "peek closed\n"); - ret = 0; - goto shut; - case SSL_ERROR_SSL: - ERR_print_errors(bio_err); - goto shut; - /* break; */ + k = SSL_read(con, sbuf, p); } + } else { + k = SSL_read(con, sbuf, 1024 /* BUFSIZZ */ ); } - - k = SSL_read(con, sbuf, 1024 /* BUFSIZZ */ ); switch (SSL_get_error(con, k)) { case SSL_ERROR_NONE: