diff options
| author | jsing <> | 2020-01-22 06:40:42 +0000 |
|---|---|---|
| committer | jsing <> | 2020-01-22 06:40:42 +0000 |
| commit | 24e2a02e17a0f1229648b4dd6046a6a9463ea814 (patch) | |
| tree | 7b9ec34196e1c0571a5a0695ccc7efc702f467e5 /src | |
| parent | 3f5737880e9439733cf4eac663937ea3334b7fb8 (diff) | |
| download | openbsd-24e2a02e17a0f1229648b4dd6046a6a9463ea814.tar.gz openbsd-24e2a02e17a0f1229648b4dd6046a6a9463ea814.tar.bz2 openbsd-24e2a02e17a0f1229648b4dd6046a6a9463ea814.zip | |
Simplify the peekaboo code.
ok beck@
Diffstat (limited to '')
| -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) |
