diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/usr.bin/openssl/s_time.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/src/usr.bin/openssl/s_time.c b/src/usr.bin/openssl/s_time.c index ee4e584bd9..920b62221c 100644 --- a/src/usr.bin/openssl/s_time.c +++ b/src/usr.bin/openssl/s_time.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: s_time.c,v 1.10 2015/09/10 06:36:45 bcook Exp $ */ | 1 | /* $OpenBSD: s_time.c,v 1.11 2015/09/11 02:08:34 lteo 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 | * |
| @@ -56,8 +56,6 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #define NO_SHUTDOWN | ||
| 60 | |||
| 61 | /*----------------------------------------- | 59 | /*----------------------------------------- |
| 62 | s_time - SSL client connection timer program | 60 | s_time - SSL client connection timer program |
| 63 | Written and donated by Larry Streepy <streepy@healthcare.com> | 61 | Written and donated by Larry Streepy <streepy@healthcare.com> |
| @@ -114,6 +112,7 @@ struct { | |||
| 114 | char *keyfile; | 112 | char *keyfile; |
| 115 | int maxtime; | 113 | int maxtime; |
| 116 | int nbio; | 114 | int nbio; |
| 115 | int no_shutdown; | ||
| 117 | int perform; | 116 | int perform; |
| 118 | int verify; | 117 | int verify; |
| 119 | int verify_depth; | 118 | int verify_depth; |
| @@ -184,6 +183,12 @@ struct option s_time_options[] = { | |||
| 184 | .value = 1, | 183 | .value = 1, |
| 185 | }, | 184 | }, |
| 186 | { | 185 | { |
| 186 | .name = "no_shutdown", | ||
| 187 | .desc = "Shutdown the connection without notifying the server", | ||
| 188 | .type = OPTION_FLAG, | ||
| 189 | .opt.flag = &s_time_config.no_shutdown, | ||
| 190 | }, | ||
| 191 | { | ||
| 187 | .name = "reuse", | 192 | .name = "reuse", |
| 188 | .desc = "Reuse the same session ID for each connection", | 193 | .desc = "Reuse the same session ID for each connection", |
| 189 | .type = OPTION_VALUE, | 194 | .type = OPTION_VALUE, |
| @@ -221,7 +226,7 @@ s_time_usage(void) | |||
| 221 | "usage: s_time " | 226 | "usage: s_time " |
| 222 | "[-bugs] [-CAfile file] [-CApath directory] [-cert file]\n" | 227 | "[-bugs] [-CAfile file] [-CApath directory] [-cert file]\n" |
| 223 | " [-cipher cipherlist] [-connect host:port] [-key keyfile]\n" | 228 | " [-cipher cipherlist] [-connect host:port] [-key keyfile]\n" |
| 224 | " [-nbio] [-new] [-reuse] [-time seconds]\n" | 229 | " [-nbio] [-new] [-no_shutdown] [-reuse] [-time seconds]\n" |
| 225 | " [-verify depth] [-www page]\n\n"); | 230 | " [-verify depth] [-www page]\n\n"); |
| 226 | options_usage(s_time_options); | 231 | options_usage(s_time_options); |
| 227 | } | 232 | } |
| @@ -342,11 +347,11 @@ s_time_main(int argc, char **argv) | |||
| 342 | while ((i = SSL_read(scon, buf, sizeof(buf))) > 0) | 347 | while ((i = SSL_read(scon, buf, sizeof(buf))) > 0) |
| 343 | bytes_read += i; | 348 | bytes_read += i; |
| 344 | } | 349 | } |
| 345 | #ifdef NO_SHUTDOWN | 350 | if (s_time_config.no_shutdown) |
| 346 | SSL_set_shutdown(scon, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN); | 351 | SSL_set_shutdown(scon, SSL_SENT_SHUTDOWN | |
| 347 | #else | 352 | SSL_RECEIVED_SHUTDOWN); |
| 348 | SSL_shutdown(scon); | 353 | else |
| 349 | #endif | 354 | SSL_shutdown(scon); |
| 350 | shutdown(SSL_get_fd(scon), SHUT_RDWR); | 355 | shutdown(SSL_get_fd(scon), SHUT_RDWR); |
| 351 | close(SSL_get_fd(scon)); | 356 | close(SSL_get_fd(scon)); |
| 352 | 357 | ||
| @@ -401,11 +406,11 @@ next: | |||
| 401 | SSL_write(scon, buf, strlen(buf)); | 406 | SSL_write(scon, buf, strlen(buf)); |
| 402 | while (SSL_read(scon, buf, sizeof(buf)) > 0); | 407 | while (SSL_read(scon, buf, sizeof(buf)) > 0); |
| 403 | } | 408 | } |
| 404 | #ifdef NO_SHUTDOWN | 409 | if (s_time_config.no_shutdown) |
| 405 | SSL_set_shutdown(scon, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN); | 410 | SSL_set_shutdown(scon, SSL_SENT_SHUTDOWN | |
| 406 | #else | 411 | SSL_RECEIVED_SHUTDOWN); |
| 407 | SSL_shutdown(scon); | 412 | else |
| 408 | #endif | 413 | SSL_shutdown(scon); |
| 409 | shutdown(SSL_get_fd(scon), SHUT_RDWR); | 414 | shutdown(SSL_get_fd(scon), SHUT_RDWR); |
| 410 | close(SSL_get_fd(scon)); | 415 | close(SSL_get_fd(scon)); |
| 411 | 416 | ||
| @@ -435,11 +440,11 @@ next: | |||
| 435 | while ((i = SSL_read(scon, buf, sizeof(buf))) > 0) | 440 | while ((i = SSL_read(scon, buf, sizeof(buf))) > 0) |
| 436 | bytes_read += i; | 441 | bytes_read += i; |
| 437 | } | 442 | } |
| 438 | #ifdef NO_SHUTDOWN | 443 | if (s_time_config.no_shutdown) |
| 439 | SSL_set_shutdown(scon, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN); | 444 | SSL_set_shutdown(scon, SSL_SENT_SHUTDOWN | |
| 440 | #else | 445 | SSL_RECEIVED_SHUTDOWN); |
| 441 | SSL_shutdown(scon); | 446 | else |
| 442 | #endif | 447 | SSL_shutdown(scon); |
| 443 | shutdown(SSL_get_fd(scon), SHUT_RDWR); | 448 | shutdown(SSL_get_fd(scon), SHUT_RDWR); |
| 444 | close(SSL_get_fd(scon)); | 449 | close(SSL_get_fd(scon)); |
| 445 | 450 | ||
