few cosmetic changes; added block for future implementation of keyboard-interactive method.
This commit is contained in:
parent
16be3fc778
commit
278219fc0a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: ssh2.c,v 1.10 2007/07/19 15:29:06 gknauf Exp $
|
||||
* $Id: ssh2.c,v 1.11 2007/07/19 15:43:48 gknauf Exp $
|
||||
*
|
||||
* Sample showing how to do SSH2 connect.
|
||||
*
|
||||
@ -119,19 +119,29 @@ int main(int argc, char *argv[])
|
||||
if (auth_pw & 1) {
|
||||
/* We could authenticate via password */
|
||||
if (libssh2_userauth_password(session, username, password)) {
|
||||
printf("Authentication by password failed.\n");
|
||||
printf("\tAuthentication by password failed!\n");
|
||||
goto shutdown;
|
||||
} else {
|
||||
printf("Authentication by password succeeded.\n");
|
||||
printf("\tAuthentication by password succeeded.\n");
|
||||
}
|
||||
} else if (auth_pw & 2) {
|
||||
/* Or by public key */
|
||||
if (libssh2_userauth_publickey_fromfile(session, username, keyfile1, keyfile2, password)) {
|
||||
printf("\tAuthentication by public key failed\n");
|
||||
printf("\tAuthentication by public key failed!\n");
|
||||
goto shutdown;
|
||||
} else {
|
||||
printf("Authentication by public key succeeded.\n");
|
||||
printf("\tAuthentication by public key succeeded.\n");
|
||||
}
|
||||
#if 0 /* !! not implemented yet !! */
|
||||
} else if (auth_pw & 4) {
|
||||
/* Or via keyboard-interactive */
|
||||
if (libssh2_userauth_keyboard_interactive(session, username, getpw_callback) ) {
|
||||
printf("\tAuthentication by keyboard-interactive failed!\n");
|
||||
goto shutdown;
|
||||
} else {
|
||||
printf("\tAuthentication by keyboard-interactive succeeded.\n");
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
printf("No supported authentication methods found!\n");
|
||||
goto shutdown;
|
||||
|
Loading…
x
Reference in New Issue
Block a user