mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-12 11:10:28 +09:00
SSH2 NONE authentication
Signed-off-by: Shreyas Mahajan <shreyasmahajan05@gmail.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
committed by
Jakub Jelen
parent
50313883f3
commit
c0963b3417
@@ -337,6 +337,7 @@ static void batch_shell(ssh_session session)
|
||||
static int client(ssh_session session)
|
||||
{
|
||||
int auth = 0;
|
||||
int authenticated = 0;
|
||||
char *banner = NULL;
|
||||
int state;
|
||||
|
||||
@@ -369,16 +370,28 @@ static int client(ssh_session session)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ssh_userauth_none(session, NULL);
|
||||
banner = ssh_get_issue_banner(session);
|
||||
if (banner) {
|
||||
printf("%s\n", banner);
|
||||
free(banner);
|
||||
}
|
||||
auth = authenticate_console(session);
|
||||
if (auth != SSH_AUTH_SUCCESS) {
|
||||
auth = ssh_userauth_none(session, NULL);
|
||||
if (auth == SSH_AUTH_SUCCESS) {
|
||||
authenticated = 1;
|
||||
} else if (auth == SSH_AUTH_ERROR) {
|
||||
fprintf(stderr,
|
||||
"Authentication error during none auth: %s\n",
|
||||
ssh_get_error(session));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!authenticated) {
|
||||
auth = authenticate_console(session);
|
||||
if (auth != SSH_AUTH_SUCCESS) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (cmds[0] == NULL) {
|
||||
shell(session);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user