diff options
author | beck <> | 2020-01-23 03:35:54 +0000 |
---|---|---|
committer | beck <> | 2020-01-23 03:35:54 +0000 |
commit | ad05f547c71854756a76beb175202b0f9a417234 (patch) | |
tree | 3e7f490484766f0f58ba050730d248c499e260b1 /src | |
parent | 7e2f15593307fc374a9a0b62d562093d20e0f4aa (diff) | |
download | openbsd-ad05f547c71854756a76beb175202b0f9a417234.tar.gz openbsd-ad05f547c71854756a76beb175202b0f9a417234.tar.bz2 openbsd-ad05f547c71854756a76beb175202b0f9a417234.zip |
Make -peekaboo mode also use SSL_pending after peeking, to ensure
SSL_pending implementation is correct.
annoying jsing@
Diffstat (limited to 'src')
-rw-r--r-- | src/usr.bin/openssl/s_client.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/usr.bin/openssl/s_client.c b/src/usr.bin/openssl/s_client.c index b86f42e00d..1537ebcb26 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.40 2020/01/22 06:40:42 jsing Exp $ */ | 1 | /* $OpenBSD: s_client.c,v 1.41 2020/01/23 03:35:54 beck 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 | * |
@@ -292,7 +292,7 @@ s_client_main(int argc, char **argv) | |||
292 | { | 292 | { |
293 | unsigned int off = 0, clr = 0; | 293 | unsigned int off = 0, clr = 0; |
294 | SSL *con = NULL; | 294 | SSL *con = NULL; |
295 | int s, k, p, state = 0, af = AF_UNSPEC; | 295 | int s, k, p, pending, state = 0, af = AF_UNSPEC; |
296 | char *cbuf = NULL, *sbuf = NULL, *mbuf = NULL, *pbuf = NULL; | 296 | char *cbuf = NULL, *sbuf = NULL, *mbuf = NULL, *pbuf = NULL; |
297 | int cbuf_len, cbuf_off; | 297 | int cbuf_len, cbuf_off; |
298 | int sbuf_len, sbuf_off; | 298 | int sbuf_len, sbuf_off; |
@@ -1123,6 +1123,7 @@ re_start: | |||
1123 | #endif | 1123 | #endif |
1124 | if (peekaboo) { | 1124 | if (peekaboo) { |
1125 | k = p = SSL_peek(con, pbuf, 1024 /* BUFSIZZ */ ); | 1125 | k = p = SSL_peek(con, pbuf, 1024 /* BUFSIZZ */ ); |
1126 | pending = SSL_pending(con); | ||
1126 | if (SSL_get_error(con, p) == SSL_ERROR_NONE) { | 1127 | if (SSL_get_error(con, p) == SSL_ERROR_NONE) { |
1127 | if (p <= 0) | 1128 | if (p <= 0) |
1128 | goto end; | 1129 | goto end; |
@@ -1142,6 +1143,12 @@ re_start: | |||
1142 | sbuf_off = 0; | 1143 | sbuf_off = 0; |
1143 | sbuf_len = k; | 1144 | sbuf_len = k; |
1144 | if (peekaboo) { | 1145 | if (peekaboo) { |
1146 | if (p != pending) { | ||
1147 | ret = -1; | ||
1148 | BIO_printf(bio_err, | ||
1149 | "peeked %d but pending %d!\n", p, pending); | ||
1150 | goto shut; | ||
1151 | } | ||
1145 | if (k < p) { | 1152 | if (k < p) { |
1146 | ret = -1; | 1153 | ret = -1; |
1147 | BIO_printf(bio_err, | 1154 | BIO_printf(bio_err, |