The branch master has been updated via bb2fb5d7cc6c4abc888c3fd6df4366b6dfde25a6 (commit) from bd654f7e98e13c0dc3b5c707880b9a77ba9e342f (commit)
- Log ----------------------------------------------------------------- commit bb2fb5d7cc6c4abc888c3fd6df4366b6dfde25a6 Author: Rami Khaldi <rami.kha...@fau.de> Date: Tue Nov 23 23:27:35 2021 +0100 Implement a new flag for running s_client in a non-interactive mode Reviewed-by: Paul Dale <pa...@openssl.org> Reviewed-by: Tomas Mraz <to...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17097) ----------------------------------------------------------------------- Summary of changes: apps/s_client.c | 15 ++++++++++++++- doc/man1/openssl-s_client.pod.in | 5 +++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/s_client.c b/apps/s_client.c index 06a58a8b51..cbce988c97 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -434,7 +434,7 @@ typedef enum OPTION_choice { OPT_XMPPHOST, OPT_VERIFY, OPT_NAMEOPT, OPT_CERT, OPT_CRL, OPT_CRL_DOWNLOAD, OPT_SESS_OUT, OPT_SESS_IN, OPT_CERTFORM, OPT_CRLFORM, OPT_VERIFY_RET_ERROR, OPT_VERIFY_QUIET, - OPT_BRIEF, OPT_PREXIT, OPT_CRLF, OPT_QUIET, OPT_NBIO, + OPT_BRIEF, OPT_PREXIT, OPT_NO_INTERACTIVE, OPT_CRLF, OPT_QUIET, OPT_NBIO, OPT_SSL_CLIENT_ENGINE, OPT_IGN_EOF, OPT_NO_IGN_EOF, OPT_DEBUG, OPT_TLSEXTDEBUG, OPT_STATUS, OPT_WDEBUG, OPT_MSG, OPT_MSGFILE, OPT_ENGINE, OPT_TRACE, OPT_SECURITY_DEBUG, @@ -569,6 +569,8 @@ const OPTIONS s_client_options[] = { "Restrict output to brief summary of connection parameters"}, {"prexit", OPT_PREXIT, '-', "Print session information when the program exits"}, + {"no-interactive", OPT_NO_INTERACTIVE, '-', + "Don't run the client in the interactive mode"}, OPT_SECTION("Debug"), {"showcerts", OPT_SHOWCERTS, '-', @@ -822,6 +824,7 @@ int s_client_main(int argc, char **argv) int build_chain = 0, cbuf_len, cbuf_off, cert_format = FORMAT_UNDEF; int key_format = FORMAT_UNDEF, crlf = 0, full_log = 1, mbuf_len = 0; int prexit = 0; + int nointeractive = 0; int sdebug = 0; int reconnect = 0, verify = SSL_VERIFY_NONE, vpmtouched = 0; int ret = 1, in_init = 1, i, nbio_test = 0, sock = -1, k, width, state = 0; @@ -1080,6 +1083,9 @@ int s_client_main(int argc, char **argv) case OPT_PREXIT: prexit = 1; break; + case OPT_NO_INTERACTIVE: + nointeractive = 1; + break; case OPT_CRLF: crlf = 1; break; @@ -2950,6 +2956,13 @@ int s_client_main(int argc, char **argv) goto shut; } } + + /* don't wait for client input in the non-interactive mode */ + else if (nointeractive) { + ret = 0; + goto shut; + } + /* OPENSSL_SYS_MSDOS includes OPENSSL_SYS_WINDOWS */ #if defined(OPENSSL_SYS_MSDOS) else if (has_stdin_waiting()) diff --git a/doc/man1/openssl-s_client.pod.in b/doc/man1/openssl-s_client.pod.in index be0f5040ff..c0a940aa71 100644 --- a/doc/man1/openssl-s_client.pod.in +++ b/doc/man1/openssl-s_client.pod.in @@ -48,6 +48,7 @@ B<openssl> B<s_client> [B<-reconnect>] [B<-showcerts>] [B<-prexit>] +[B<-no-interactive>] [B<-debug>] [B<-trace>] [B<-nocommands>] @@ -419,6 +420,10 @@ attempt is made to access a certain URL. Note: the output produced by this option is not always accurate because a connection might never have been established. +=item B<-no-interactive> + +This flag can be used to run the client in a non-interactive mode. + =item B<-state> Prints out the SSL session states.