mirror of
https://github.com/openssl/openssl.git
synced 2025-02-17 14:32:04 +08:00
Implement a new flag for running s_client in a non-interactive mode
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17097)
This commit is contained in:
parent
bd654f7e98
commit
bb2fb5d7cc
@ -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())
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user