From 55a7c6b26d599459cb8d62638cddc137906d0536 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 9 Nov 2012 15:42:39 +0100 Subject: add some debug code --- src/x2go-auth-check.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/x2go-auth-check.c b/src/x2go-auth-check.c index 5bd6c1a..8a3fb01 100644 --- a/src/x2go-auth-check.c +++ b/src/x2go-auth-check.c @@ -18,6 +18,10 @@ #include #include +#include +#include +#include + int main (int argc, char * argv[]) @@ -28,18 +32,27 @@ main (int argc, char * argv[]) return -1; } + printf ("1\n"); + if (scanf("%511s", password) != 1) { return -1; } + printf ("2\n"); + if (mlock(password, sizeof(password)) != 0) { return -1; } + printf ("3\n"); + ssh_session auth_check_ssh_session = ssh_new(); - ssh_options_set ( auth_check_ssh_session, SSH_OPTIONS_HOST, argv[1] ); - ssh_options_set ( auth_check_ssh_session, SSH_OPTIONS_USER, argv[2] ); + ssh_options_set ( auth_check_ssh_session, SSH_OPTIONS_HOST, &argv[1] ); + ssh_options_set ( auth_check_ssh_session, SSH_OPTIONS_USER, &argv[2] ); + + printf ("host: %s\n", argv[1]); + printf ("user: %s\n", argv[2]); char * colonloc = strstr(argv[1], ":"); if (colonloc != NULL) { @@ -47,9 +60,13 @@ main (int argc, char * argv[]) colonloc[0] = '\0'; colonloc++; - ssh_options_set ( auth_check_ssh_session, SSH_OPTIONS_PORT, strtoul(colonloc, NULL, 10) ); + long port = strtoul(colonloc, NULL, 10); + ssh_options_set ( auth_check_ssh_session, SSH_OPTIONS_PORT, &port ); + printf ("port: %i\n", port); } + printf ("4\n"); + int rc = -1; if (ssh_connect (auth_check_ssh_session)) { rc = ssh_userauth_password ( auth_check_ssh_session, NULL, password ); @@ -57,6 +74,8 @@ main (int argc, char * argv[]) } ssh_free(auth_check_ssh_session); + printf ("5\n"); + int retval = -1; if ( rc == SSH_AUTH_SUCCESS ) { -- cgit v1.2.3