summaryrefslogtreecommitdiff
path: root/src/cli.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2014-11-13 14:12:15 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2014-11-13 14:12:18 +0100
commitd75304f487cb4faf9443fb074ca6771f3bf65c10 (patch)
tree6eb7ffe1f088428c114b4078d10f92902e14205b /src/cli.c
parent88289f4402d1f3b2063c007fb7029996bd97b987 (diff)
downloadgnutls-d75304f487cb4faf9443fb074ca6771f3bf65c10.tar.gz
gnutls-cli: added option to save the OCSP response
Diffstat (limited to 'src/cli.c')
-rw-r--r--src/cli.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/cli.c b/src/cli.c
index ab4f83ef98..c7f3bfeb52 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -1040,6 +1040,24 @@ int do_inline_command_processing(char *buffer_ptr, size_t curr_bytes,
}
}
+static void
+print_other_info(gnutls_session_t session)
+{
+ int ret;
+ gnutls_datum_t data;
+
+ if (HAVE_OPT(SAVE_OCSP)) {
+ FILE *fp = fopen(OPT_ARG(SAVE_OCSP), "w");
+
+ if (fp != NULL) {
+ ret = gnutls_ocsp_status_request_get(session, &data);
+ if (ret >= 0)
+ fwrite(data.data, 1, data.size, fp);
+ fclose(fp);
+ }
+ }
+}
+
int main(int argc, char **argv)
{
int ret;
@@ -1094,6 +1112,8 @@ int main(int argc, char **argv)
if (try_resume(&hd))
return 1;
+ print_other_info(hd.session);
+
after_handshake:
/* Warning! Do not touch this text string, it is used by external