summaryrefslogtreecommitdiff
path: root/src/cli.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-08-22 08:46:04 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-08-22 11:27:37 +0200
commit3ce7bc7b7d0a0daded5bd5a338b8361e5ac755f5 (patch)
tree34c4c54e15d6daec2af2447f49ad3de4e2249114 /src/cli.c
parent39cdaed454b12c7be9881d550ec2ea89c649c707 (diff)
downloadgnutls-3ce7bc7b7d0a0daded5bd5a338b8361e5ac755f5.tar.gz
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.
Diffstat (limited to 'src/cli.c')
-rw-r--r--src/cli.c16
1 files changed, 11 insertions, 5 deletions
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. */