From d36560b73e98fd3e0cba03fb8c43b8e105ccbb84 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 9 Nov 2012 16:19:33 +0100 Subject: split up hostname and port properly --- src/x2go-auth-check.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/x2go-auth-check.c b/src/x2go-auth-check.c index 9e1aba3..505f040 100644 --- a/src/x2go-auth-check.c +++ b/src/x2go-auth-check.c @@ -59,13 +59,22 @@ main (int argc, char * argv[]) char * colonloc = strstr(argv[1], ":"); if (colonloc != NULL) { - /* We've got a port to deal with */ + /* We've got a port to deal with colonloc[0] = '\0'; colonloc++; + */ - long port = strtoul(colonloc, NULL, 10); + char *hostname = strtok( argv[1], ":" ); + long port = strtoul(strtok( argv[1], ":" )); + + // long port = strtoul(colonloc, NULL, 10); + ssh_options_set ( auth_check_ssh_session, SSH_OPTIONS_HOST, &hostname ); ssh_options_set ( auth_check_ssh_session, SSH_OPTIONS_PORT, &port ); + printf ("host: %s\n", hostname); printf ("port: %li\n", port); + } else { + printf ("host: %s\n", argv[1]); + ssh_options_set ( auth_check_ssh_session, SSH_OPTIONS_HOST, &argv[1] ); } printf ("4\n"); -- cgit v1.2.3