From 5d51fe80c6250c60adbf0b83f5e3cf40088973f7 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Mon, 30 May 2016 12:57:55 +0200 Subject: tools: allow specifying a hostname with a port attached That is: gnutls-cli www.example.com:443 is equivalent to gnutls-cli www.example.com -p 443 --- src/cli.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/cli.c') diff --git a/src/cli.c b/src/cli.c index 479a9eb2f2..1e60b6c7d8 100644 --- a/src/cli.c +++ b/src/cli.c @@ -73,7 +73,7 @@ /* global stuff here */ int resume, starttls, insecure, ranges, rehandshake, udp, mtu, inline_commands; -const char *hostname = NULL; +char *hostname = NULL; char service[32]=""; int record_max_size; int fingerprint; @@ -904,6 +904,8 @@ static int try_resume(socket_st * hd) printf("- Disconnecting\n"); socket_bye(hd); + canonicalize_host(hostname, service, sizeof(service)); + printf ("\n\n- Connecting again- trying to resume previous session\n"); socket_open(hd, hostname, service, udp, CONNECT_MSG); @@ -1207,6 +1209,8 @@ int main(int argc, char **argv) init_global_tls_stuff(); + canonicalize_host(hostname, service, sizeof(service)); + socket_open(&hd, hostname, service, udp, CONNECT_MSG); hd.verbose = verbose; @@ -1478,7 +1482,7 @@ void print_priority_list(void) static void cmd_parser(int argc, char **argv) { - const char *rest = NULL; + char *rest = NULL; int optct = optionProcess(&gnutls_cliOptions, argc, argv); argc -= optct; -- cgit v1.2.1