Don't request userauthlist after authentication.
Этот коммит содержится в:
родитель
ea8babf6d1
Коммит
c573af83de
@ -93,6 +93,14 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
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 */
|
/* Connect to the ssh-agent */
|
||||||
agent = libssh2_agent_init(session);
|
agent = libssh2_agent_init(session);
|
||||||
if (!agent) {
|
if (!agent) {
|
||||||
@ -149,14 +157,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
printf("\n");
|
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 */
|
/* Request a shell */
|
||||||
if (!(channel = libssh2_channel_open_session(session))) {
|
if (!(channel = libssh2_channel_open_session(session))) {
|
||||||
fprintf(stderr, "Unable to open a session\n");
|
fprintf(stderr, "Unable to open a session\n");
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user