diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2012-06-15 12:46:09 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2012-06-15 12:46:09 +0000 |
commit | 93ab9e421e4517b81d11ca741d55e6bb6f696c40 (patch) | |
tree | 04cf24ccc17855f9fb19412dd359b792e5855c85 /apps/s_client.c | |
parent | dfcf48f499f19fd17a3aee03151ea301814ea6ec (diff) |
Initial record tracing code. Print out all fields in SSL/TLS records
for debugging purposes. Needs "enable-ssl-trace" configuration option.
Diffstat (limited to 'apps/s_client.c')
-rw-r--r-- | apps/s_client.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/apps/s_client.c b/apps/s_client.c index 556563e14d..578b541b13 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -217,6 +217,7 @@ static int ocsp_resp_cb(SSL *s, void *arg); static int audit_proof_cb(SSL *s, void *arg); #endif static BIO *bio_c_out=NULL; +static BIO *bio_c_msg=NULL; static int c_quiet=0; static int c_ign_eof=0; @@ -743,6 +744,15 @@ int MAIN(int argc, char **argv) #endif else if (strcmp(*argv,"-msg") == 0) c_msg=1; + else if (strcmp(*argv,"-msgfile") == 0) + { + if (--argc < 1) goto bad; + bio_c_msg = BIO_new_file(*(++argv), "w"); + } +#ifndef OPENSSL_NO_SSL_TRACE + else if (strcmp(*argv,"-trace") == 0) + c_msg=2; +#endif else if (strcmp(*argv,"-showcerts") == 0) c_showcerts=1; else if (strcmp(*argv,"-nbio_test") == 0) @@ -1348,8 +1358,13 @@ re_start: } if (c_msg) { - SSL_set_msg_callback(con, msg_cb); - SSL_set_msg_callback_arg(con, bio_c_out); +#ifndef OPENSSL_NO_SSL_TRACE + if (c_msg == 2) + SSL_set_msg_callback(con, SSL_trace); + else +#endif + SSL_set_msg_callback(con, msg_cb); + SSL_set_msg_callback_arg(con, bio_c_msg ? bio_c_msg : bio_c_out); } #ifndef OPENSSL_NO_TLSEXT if (c_tlsextdebug) @@ -1926,6 +1941,11 @@ end: BIO_free(bio_c_out); bio_c_out=NULL; } + if (bio_c_msg != NULL) + { + BIO_free(bio_c_msg); + bio_c_msg=NULL; + } apps_shutdown(); OPENSSL_EXIT(ret); } |