From c573af83deec681abccf53fcb8cbcb6924b0c365 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Wed, 23 Dec 2009 07:59:37 +0900 Subject: [PATCH] Don't request userauthlist after authentication. --- example/ssh2_agent.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/example/ssh2_agent.c b/example/ssh2_agent.c index a8e8519..6b0c323 100644 --- a/example/ssh2_agent.c +++ b/example/ssh2_agent.c @@ -93,6 +93,14 @@ int main(int argc, char *argv[]) return 1; } + /* check what authentication methods are available */ + userauthlist = libssh2_userauth_list(session, username, strlen(username)); + printf("Authentication methods: %s\n", userauthlist); + if (strstr(userauthlist, "publickey") == NULL) { + fprintf(stderr, "\"publickey\" authentication is not supported\n"); + goto shutdown; + } + /* Connect to the ssh-agent */ agent = libssh2_agent_init(session); if (!agent) { @@ -149,14 +157,6 @@ int main(int argc, char *argv[]) } printf("\n"); - /* check what authentication methods are available */ - userauthlist = libssh2_userauth_list(session, username, strlen(username)); - printf("Authentication methods: %s\n", userauthlist); - if (strstr(userauthlist, "publickey") == NULL) { - fprintf(stderr, "\"publickey\" authentication is not supported\n"); - goto shutdown; - } - /* Request a shell */ if (!(channel = libssh2_channel_open_session(session))) { fprintf(stderr, "Unable to open a session\n");