aboutsummaryrefslogtreecommitdiff
path: root/src/x2go-auth-check.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/x2go-auth-check.c')
-rw-r--r--src/x2go-auth-check.c25
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 )
{