Add -brief option to s_client and s_server to summarise connection details.

New option -verify_quiet to shut up the verify callback unless there is
an error.
This commit is contained in:
Dr. Stephen Henson
2012-09-12 23:14:28 +00:00
parent 94a209d8e1
commit 2a7cbe77b3
5 changed files with 125 additions and 16 deletions

View File

@@ -193,6 +193,7 @@ typedef unsigned int u_int;
extern int verify_depth;
extern int verify_error;
extern int verify_return_error;
extern int verify_quiet;
#ifdef FIONBIO
static int c_nbio=0;
@@ -220,6 +221,7 @@ static BIO *bio_c_out=NULL;
static BIO *bio_c_msg=NULL;
static int c_quiet=0;
static int c_ign_eof=0;
static int c_brief=0;
#ifndef OPENSSL_NO_PSK
/* Default PSK identity and key */
@@ -688,7 +690,8 @@ int MAIN(int argc, char **argv)
verify=SSL_VERIFY_PEER;
if (--argc < 1) goto bad;
verify_depth=atoi(*(++argv));
BIO_printf(bio_err,"verify depth is %d\n",verify_depth);
if (!c_quiet)
BIO_printf(bio_err,"verify depth is %d\n",verify_depth);
}
else if (strcmp(*argv,"-cert") == 0)
{
@@ -718,6 +721,14 @@ int MAIN(int argc, char **argv)
}
else if (strcmp(*argv,"-verify_return_error") == 0)
verify_return_error = 1;
else if (strcmp(*argv,"-verify_quiet") == 0)
verify_quiet = 1;
else if (strcmp(*argv,"-brief") == 0)
{
c_brief = 1;
verify_quiet = 1;
c_quiet = 1;
}
else if (args_excert(&argv, &argc, &badarg, bio_err, &exc))
{
if (badarg)
@@ -1611,6 +1622,12 @@ SSL_set_tlsext_status_ids(con, ids);
else
BIO_printf(bio_err, "Error writing session file %s\n", sess_out);
}
if (c_brief)
{
BIO_puts(bio_err,
"CONNECTION ESTABLISHED\n");
print_ssl_summary(bio_err, con);
}
print_stuff(bio_c_out,con,full_log);
if (full_log > 0) full_log--;