From f7700f2bc2f2d5876c91bbbf3eaae233ee1548b1 Mon Sep 17 00:00:00 2001 From: Aris Adamantiadis Date: Mon, 24 Nov 2008 18:05:55 +0000 Subject: patches 0001-Save-the-last-error-and-provide-a-function-to-get-it.patch, 0002-Use-const-whereever-it-makes-sense.patch, 0003-Implement-function-to-retrieve-userauth-possabilitie.patch from Andreas Schneider git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@191 7dcaeef0-15fb-0310-b436-a5af3365683c --- sample.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'sample.c') diff --git a/sample.c b/sample.c index 7baff76..6020066 100644 --- a/sample.c +++ b/sample.c @@ -440,6 +440,19 @@ int main(int argc, char **argv){ exit(-1); } + ssh_userauth_none(session, NULL); + + auth = ssh_auth_list(session); + printf("auth: 0x%04x\n", auth); + printf("supported auth methods: "); + if (auth & SSH_AUTH_METHOD_PUBLICKEY) { + printf("publickey"); + } + if (auth & SSH_AUTH_METHOD_INTERACTIVE) { + printf(", keyboard-interactive"); + } + printf("\n"); + /* no ? you should :) */ auth=ssh_userauth_autopubkey(session); if(auth==SSH_AUTH_ERROR){ @@ -462,7 +475,7 @@ int main(int argc, char **argv){ } } if(auth!=SSH_AUTH_SUCCESS){ - password=getpass("Password : "); + password=getpass("Password: "); if(ssh_userauth_password(session,NULL,password) != SSH_AUTH_SUCCESS){ fprintf(stderr,"Authentication failed: %s\n",ssh_get_error(session)); ssh_disconnect(session); -- cgit