From 3ce7bc7b7d0a0daded5bd5a338b8361e5ac755f5 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Mon, 22 Aug 2016 08:46:04 +0200 Subject: gnutls-cli: fixed the behavior when --starttls or --starttls-proto is given The change of moving the handshake process as part of the socket establishment broke the starttls functionality in gnutls-cli. This change fixes that functionality. Reported by Andreas Metzler. --- src/cli.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/cli.c') diff --git a/src/cli.c b/src/cli.c index 0913898f8b..61be2cae7e 100644 --- a/src/cli.c +++ b/src/cli.c @@ -1212,19 +1212,25 @@ int main(int argc, char **argv) socket_flags |= SOCKET_FLAG_UDP; if (fastopen) socket_flags |= SOCKET_FLAG_FASTOPEN; + if (verbose) + socket_flags |= SOCKET_FLAG_VERBOSE; if (starttls) + socket_flags |= SOCKET_FLAG_RAW; + else if (HAVE_OPT(STARTTLS_PROTO)) socket_flags |= SOCKET_FLAG_STARTTLS; socket_open(&hd, hostname, service, OPT_ARG(STARTTLS_PROTO), socket_flags, CONNECT_MSG, NULL); hd.verbose = verbose; - printf("- Handshake was completed\n"); + if (hd.secure) { + printf("- Handshake was completed\n"); - if (resume != 0) - if (try_resume(&hd)) - return 1; + if (resume != 0) + if (try_resume(&hd)) + return 1; - print_other_info(hd.session); + print_other_info(hd.session); + } /* Warning! Do not touch this text string, it is used by external programs to search for when gnutls-cli has reached this point. */ -- cgit v1.2.1