diff options
author | jsing <> | 2020-01-22 06:40:42 +0000 |
---|---|---|
committer | jsing <> | 2020-01-22 06:40:42 +0000 |
commit | 9688e1dfd0a77a6aa72326ee207ea1265bc91768 (patch) | |
tree | 7b9ec34196e1c0571a5a0695ccc7efc702f467e5 /src | |
parent | 9e9db88c593e9fe3ec46a015b783a8903db297c3 (diff) | |
download | openbsd-9688e1dfd0a77a6aa72326ee207ea1265bc91768.tar.gz openbsd-9688e1dfd0a77a6aa72326ee207ea1265bc91768.tar.bz2 openbsd-9688e1dfd0a77a6aa72326ee207ea1265bc91768.zip |
Simplify the peekaboo code.
ok beck@
Diffstat (limited to 'src')
-rw-r--r-- | src/usr.bin/openssl/s_client.c | 41 |
1 files changed, 6 insertions, 35 deletions
diff --git a/src/usr.bin/openssl/s_client.c b/src/usr.bin/openssl/s_client.c index 2cb9e26b59..b86f42e00d 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.39 2020/01/22 04:51:48 beck Exp $ */ | 1 | /* $OpenBSD: s_client.c,v 1.40 2020/01/22 06:40:42 jsing 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 | * |
@@ -1122,48 +1122,19 @@ re_start: | |||
1122 | } | 1122 | } |
1123 | #endif | 1123 | #endif |
1124 | if (peekaboo) { | 1124 | if (peekaboo) { |
1125 | p = SSL_peek(con, pbuf, 1024 /* BUFSIZZ */ ); | 1125 | k = p = SSL_peek(con, pbuf, 1024 /* BUFSIZZ */ ); |
1126 | 1126 | if (SSL_get_error(con, p) == SSL_ERROR_NONE) { | |
1127 | switch (SSL_get_error(con, k)) { | ||
1128 | case SSL_ERROR_NONE: | ||
1129 | if (p <= 0) | 1127 | if (p <= 0) |
1130 | goto end; | 1128 | goto end; |
1131 | pbuf_off = 0; | 1129 | pbuf_off = 0; |
1132 | pbuf_len = p; | 1130 | pbuf_len = p; |
1133 | 1131 | ||
1134 | break; | 1132 | k = SSL_read(con, sbuf, p); |
1135 | case SSL_ERROR_WANT_WRITE: | ||
1136 | BIO_printf(bio_c_out, "peek W BLOCK\n"); | ||
1137 | write_ssl = 1; | ||
1138 | read_tty = 0; | ||
1139 | break; | ||
1140 | case SSL_ERROR_WANT_READ: | ||
1141 | BIO_printf(bio_c_out, "peek R BLOCK\n"); | ||
1142 | write_tty = 0; | ||
1143 | read_ssl = 1; | ||
1144 | if ((read_tty == 0) && (write_ssl == 0)) | ||
1145 | write_ssl = 1; | ||
1146 | break; | ||
1147 | case SSL_ERROR_WANT_X509_LOOKUP: | ||
1148 | BIO_printf(bio_c_out, "peek X BLOCK\n"); | ||
1149 | break; | ||
1150 | case SSL_ERROR_SYSCALL: | ||
1151 | ret = errno; | ||
1152 | BIO_printf(bio_err, "peek:errno=%d\n", ret); | ||
1153 | goto shut; | ||
1154 | case SSL_ERROR_ZERO_RETURN: | ||
1155 | BIO_printf(bio_c_out, "peek closed\n"); | ||
1156 | ret = 0; | ||
1157 | goto shut; | ||
1158 | case SSL_ERROR_SSL: | ||
1159 | ERR_print_errors(bio_err); | ||
1160 | goto shut; | ||
1161 | /* break; */ | ||
1162 | } | 1133 | } |
1134 | } else { | ||
1135 | k = SSL_read(con, sbuf, 1024 /* BUFSIZZ */ ); | ||
1163 | } | 1136 | } |
1164 | 1137 | ||
1165 | k = SSL_read(con, sbuf, 1024 /* BUFSIZZ */ ); | ||
1166 | |||
1167 | switch (SSL_get_error(con, k)) { | 1138 | switch (SSL_get_error(con, k)) { |
1168 | case SSL_ERROR_NONE: | 1139 | case SSL_ERROR_NONE: |
1169 | if (k <= 0) | 1140 | if (k <= 0) |