diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2012-11-09 15:42:39 +0100 |
---|---|---|
committer | Mike Gabriel <mike@quantal.(none)> | 2012-11-09 15:42:39 +0100 |
commit | 55a7c6b26d599459cb8d62638cddc137906d0536 (patch) | |
tree | b00f6cc060d9f53262ef71385c6a4bf2e3806436 | |
parent | 5667bd031dbd9fedfdd5066050b1e5188819ac9c (diff) | |
download | libpam-x2go-55a7c6b26d599459cb8d62638cddc137906d0536.tar.gz libpam-x2go-55a7c6b26d599459cb8d62638cddc137906d0536.tar.bz2 libpam-x2go-55a7c6b26d599459cb8d62638cddc137906d0536.zip |
add some debug code
-rw-r--r-- | src/x2go-auth-check.c | 25 |
1 files changed, 22 insertions, 3 deletions
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 <libssh/libssh.h> #include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/mman.h> + 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 ) { |