summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2015-04-25 15:58:22 -0400
committerRich Salz <rsalz@openssl.org>2015-04-25 15:58:22 -0400
commit6ba8a5b77af5792bf0755388bc0ce4003af7cf86 (patch)
tree8b05280406a522f83bda5b1c9bd27350a9e5a725 /apps
parent333b070ec06d7a67538ee9d5312656a19e802dc1 (diff)
Add -nocommands to s_client.
Add flag to disable the 'command letters' from s_client. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'apps')
-rw-r--r--apps/s_client.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/apps/s_client.c b/apps/s_client.c
index 0d030056fc..d3fc3971bb 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -488,7 +488,7 @@ typedef enum OPTION_choice {
OPT_V_ENUM,
OPT_X_ENUM,
OPT_S_ENUM,
- OPT_FALLBACKSCSV
+ OPT_FALLBACKSCSV, OPT_NOCMDS
} OPTION_CHOICE;
OPTIONS s_client_options[] = {
@@ -600,6 +600,7 @@ OPTIONS s_client_options[] = {
{"build_chain", OPT_BUILD_CHAIN, '-'},
{"chainCAfile", OPT_CHAINCAFILE, '<'},
{"verifyCAfile", OPT_VERIFYCAFILE, '<'},
+ {"nocommands", OPT_NOCMDS, '-', "Do not use interactive command letters"},
#ifndef OPENSSL_NO_ENGINE
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
{"ssl_client_engine", OPT_SSL_CLIENT_ENGINE, 's'},
@@ -660,7 +661,7 @@ int s_client_main(int argc, char **argv)
int enable_timeouts = 0, sdebug = 0, peerlen = sizeof peer;
int reconnect = 0, verify = SSL_VERIFY_NONE, vpmtouched = 0;
int ret = 1, in_init = 1, i, nbio_test = 0, s, k, width, state = 0;
- int sbuf_len, sbuf_off, socket_type = SOCK_STREAM;
+ int sbuf_len, sbuf_off, socket_type = SOCK_STREAM, cmdletters = 1;
int starttls_proto = PROTO_OFF, crl_format = FORMAT_PEM, crl_download = 0;
int write_tty, read_tty, write_ssl, read_ssl, tty_on, ssl_pending;
int fallback_scsv = 0;
@@ -822,6 +823,9 @@ int s_client_main(int argc, char **argv)
case OPT_NBIO:
c_nbio = 1;
break;
+ case OPT_NOCMDS:
+ cmdletters = 0;
+ break;
case OPT_KRB5SVC:
#ifndef OPENSSL_NO_KRB5
krb5svc = opt_arg();
@@ -1906,19 +1910,19 @@ int s_client_main(int argc, char **argv)
} else
i = raw_read_stdin(cbuf, BUFSIZZ);
- if ((!c_ign_eof) && ((i <= 0) || (cbuf[0] == 'Q'))) {
+ if ((!c_ign_eof) && ((i <= 0) || (cbuf[0] == 'Q' && cmdletters))) {
BIO_printf(bio_err, "DONE\n");
ret = 0;
goto shut;
}
- if ((!c_ign_eof) && (cbuf[0] == 'R')) {
+ if ((!c_ign_eof) && (cbuf[0] == 'R' && cmdletters)) {
BIO_printf(bio_err, "RENEGOTIATING\n");
SSL_renegotiate(con);
cbuf_len = 0;
}
#ifndef OPENSSL_NO_HEARTBEATS
- else if ((!c_ign_eof) && (cbuf[0] == 'B')) {
+ else if ((!c_ign_eof) && (cbuf[0] == 'B' && cmdletters)) {
BIO_printf(bio_err, "HEARTBEATING\n");
SSL_heartbeat(con);
cbuf_len = 0;