diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2014-05-05 16:14:46 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2014-05-05 16:14:46 +0000 |
commit | a6690b6a7ec50d94d12d2cc2581b233c0e2a2d10 (patch) | |
tree | 2988bbb0ed12e26bbb0ed7bf2e08241bfe192e7a /lib/libssl | |
parent | 062122185156891f3634e1fc6431d6af0b75783b (diff) |
During the great e_os.h nukathon we stopped pulling in <sys/filio.h> via
the ifdef maze, meaning that FIONBIO was no longer defined. This removes
non-blocking I/O support from s_{client,server,time}.
Remove all FIONBIO ifdefs and import <sys/ioctl.h>, renabling -nbio.
ok miod@
Diffstat (limited to 'lib/libssl')
-rw-r--r-- | lib/libssl/src/apps/s_client.c | 15 | ||||
-rw-r--r-- | lib/libssl/src/apps/s_server.c | 18 | ||||
-rw-r--r-- | lib/libssl/src/apps/s_time.c | 8 |
3 files changed, 6 insertions, 35 deletions
diff --git a/lib/libssl/src/apps/s_client.c b/lib/libssl/src/apps/s_client.c index 87966e30d9d..2ec72876a0e 100644 --- a/lib/libssl/src/apps/s_client.c +++ b/lib/libssl/src/apps/s_client.c @@ -136,6 +136,8 @@ */ #include <sys/types.h> +#include <sys/ioctl.h> + #include <netinet/in.h> #include <assert.h> #include <ctype.h> @@ -177,9 +179,7 @@ extern int verify_depth; extern int verify_error; extern int verify_return_error; -#ifdef FIONBIO static int c_nbio = 0; -#endif static int c_Pause = 0; static int c_debug = 0; #ifndef OPENSSL_NO_TLSEXT @@ -296,9 +296,7 @@ sc_usage(void) BIO_printf(bio_err, " -msg - Show protocol messages\n"); BIO_printf(bio_err, " -nbio_test - more ssl protocol testing\n"); BIO_printf(bio_err, " -state - print the 'ssl' states\n"); -#ifdef FIONBIO BIO_printf(bio_err, " -nbio - Run with non-blocking IO\n"); -#endif BIO_printf(bio_err, " -crlf - convert LF from terminal into CRLF\n"); BIO_printf(bio_err, " -quiet - no s_client output\n"); BIO_printf(bio_err, " -ign_eof - ignore input eof (default when -quiet)\n"); @@ -629,9 +627,7 @@ s_client_main(int argc, char **argv) } verify_depth = 0; verify_error = X509_V_OK; -#ifdef FIONBIO c_nbio = 0; -#endif argc--; argv++; @@ -838,11 +834,9 @@ s_client_main(int argc, char **argv) goto bad; cipher = *(++argv); } -#ifdef FIONBIO else if (strcmp(*argv, "-nbio") == 0) { c_nbio = 1; } -#endif else if (strcmp(*argv, "-starttls") == 0) { if (--argc < 1) goto bad; @@ -1167,7 +1161,6 @@ re_start: } BIO_printf(bio_c_out, "CONNECTED(%08X)\n", s); -#ifdef FIONBIO if (c_nbio) { unsigned long l = 1; BIO_printf(bio_c_out, "turning on non blocking io\n"); @@ -1176,7 +1169,6 @@ re_start: goto end; } } -#endif if (c_Pause & 0x01) SSL_set_debug(con, 1); @@ -1389,7 +1381,8 @@ re_start: tty_on = 1; if (in_init) { in_init = 0; -#if 0 /* This test doesn't really work as intended +#if 0 + /* This test doesn't really work as intended * (needs to be fixed) */ #ifndef OPENSSL_NO_TLSEXT if (servername != NULL && !SSL_session_reused(con)) { diff --git a/lib/libssl/src/apps/s_server.c b/lib/libssl/src/apps/s_server.c index 12f6c33c132..18717d8f230 100644 --- a/lib/libssl/src/apps/s_server.c +++ b/lib/libssl/src/apps/s_server.c @@ -146,6 +146,8 @@ #undef OPENSSL_NO_DEPRECATED #endif +#include <sys/ioctl.h> + #include <assert.h> #include <ctype.h> #include <stdio.h> @@ -249,9 +251,7 @@ static const char *s_cert_file = TEST_CERT, *s_key_file = NULL; static const char *s_cert_file2 = TEST_CERT2, *s_key_file2 = NULL; #endif static char *s_dcert_file = NULL, *s_dkey_file = NULL; -#ifdef FIONBIO static int s_nbio = 0; -#endif static int s_nbio_test = 0; int s_crlf = 0; static SSL_CTX *ctx = NULL; @@ -406,9 +406,7 @@ s_server_init(void) s_key_file2 = NULL; ctx2 = NULL; #endif -#ifdef FIONBIO s_nbio = 0; -#endif s_nbio_test = 0; ctx = NULL; www = 0; @@ -456,9 +454,7 @@ sv_usage(void) " Use \"openssl ecparam -list_curves\" for all names\n" \ " (default is nistp256).\n"); #endif -#ifdef FIONBIO BIO_printf(bio_err, " -nbio - Run with non-blocking IO\n"); -#endif BIO_printf(bio_err, " -nbio_test - test with the non-blocking test bio\n"); BIO_printf(bio_err, " -crlf - convert LF from terminal into CRLF\n"); BIO_printf(bio_err, " -debug - Print more output\n"); @@ -798,9 +794,7 @@ s_server_main(int argc, char *argv[]) goto end; verify_depth = 0; -#ifdef FIONBIO s_nbio = 0; -#endif s_nbio_test = 0; argc--; @@ -909,15 +903,11 @@ s_server_main(int argc, char *argv[]) goto bad; CAfile = *(++argv); } -#ifdef FIONBIO else if (strcmp(*argv, "-nbio") == 0) { s_nbio = 1; } -#endif else if (strcmp(*argv, "-nbio_test") == 0) { -#ifdef FIONBIO s_nbio = 1; -#endif s_nbio_test = 1; } else if (strcmp(*argv, "-debug") == 0) { s_debug = 1; @@ -1661,7 +1651,6 @@ sv_body(char *hostname, int s, unsigned char *context) BIO_printf(bio_err, "out of memory\n"); goto err; } -#ifdef FIONBIO if (s_nbio) { unsigned long sl = 1; @@ -1670,7 +1659,6 @@ sv_body(char *hostname, int s, unsigned char *context) if (BIO_socket_ioctl(s, FIONBIO, &sl) < 0) ERR_print_errors(bio_err); } -#endif if (con == NULL) { con = SSL_new(ctx); @@ -2178,7 +2166,6 @@ www_body(char *hostname, int s, unsigned char *context) if ((io == NULL) || (ssl_bio == NULL)) goto err; -#ifdef FIONBIO if (s_nbio) { unsigned long sl = 1; @@ -2187,7 +2174,6 @@ www_body(char *hostname, int s, unsigned char *context) if (BIO_socket_ioctl(s, FIONBIO, &sl) < 0) ERR_print_errors(bio_err); } -#endif /* lets make the output buffer a reasonable size */ if (!BIO_set_write_buffer_size(io, bufsize)) diff --git a/lib/libssl/src/apps/s_time.c b/lib/libssl/src/apps/s_time.c index 4e95a226649..8ce2c671a2e 100644 --- a/lib/libssl/src/apps/s_time.c +++ b/lib/libssl/src/apps/s_time.c @@ -118,9 +118,7 @@ static char *s_www_path = NULL; static long bytes_read = 0; static int st_bugs = 0; static int perform = 0; -#ifdef FIONBIO static int t_nbio = 0; -#endif static void s_time_init(void) @@ -140,9 +138,7 @@ s_time_init(void) st_bugs = 0; perform = 0; -#ifdef FIONBIO t_nbio = 0; -#endif } /*********************************************************************** @@ -164,7 +160,6 @@ s_time_usage(void) printf("usage: s_time <args>\n\n"); printf("-connect host:port - host:port to connect to (default is %s)\n", SSL_CONNECT_NAME); -#ifdef FIONBIO printf("-nbio - Run with non-blocking IO\n"); printf("-ssl2 - Just use SSLv2\n"); printf("-ssl3 - Just use SSLv3\n"); @@ -172,7 +167,6 @@ s_time_usage(void) printf("-new - Just time new connections\n"); printf("-reuse - Just time connection reuse\n"); printf("-www page - Retrieve 'page' from the site\n"); -#endif printf(umsg, SECONDS); } @@ -251,11 +245,9 @@ parseArgs(int argc, char **argv) goto bad; tm_cipher = *(++argv); } -#ifdef FIONBIO else if (strcmp(*argv, "-nbio") == 0) { t_nbio = 1; } -#endif else if (strcmp(*argv, "-www") == 0) { if (--argc < 1) goto bad; |