diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2008-11-24 18:05:55 +0000 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2008-11-24 18:05:55 +0000 |
commit | f7700f2bc2f2d5876c91bbbf3eaae233ee1548b1 (patch) | |
tree | 5e80eb3b78683d183d47759582f9712e23bf84b6 /sample.c | |
parent | f880011d727e598561fe64a805a2fb22a39ffcee (diff) | |
download | libssh-f7700f2bc2f2d5876c91bbbf3eaae233ee1548b1.tar.gz libssh-f7700f2bc2f2d5876c91bbbf3eaae233ee1548b1.tar.xz libssh-f7700f2bc2f2d5876c91bbbf3eaae233ee1548b1.zip |
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
Diffstat (limited to 'sample.c')
-rw-r--r-- | sample.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -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); |