From bb47a5d76f89069db3a9c2a23755cbc9c97b1911 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Mon, 6 Dec 2021 09:19:49 +0100 Subject: [PATCH] ssh: respect keyboard-interactive prompt echo setting - fixes #5045 --- .../components/keyboardInteractiveAuthPanel.component.pug | 2 +- .../src/components/keyboardInteractiveAuthPanel.component.ts | 2 +- tabby-ssh/src/session/ssh.ts | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tabby-ssh/src/components/keyboardInteractiveAuthPanel.component.pug b/tabby-ssh/src/components/keyboardInteractiveAuthPanel.component.pug index 96c9f730..793c3c62 100644 --- a/tabby-ssh/src/components/keyboardInteractiveAuthPanel.component.pug +++ b/tabby-ssh/src/components/keyboardInteractiveAuthPanel.component.pug @@ -2,7 +2,7 @@ strong Keyboard-interactive auth .ml-2 {{prompt.name}} -.prompt-text {{prompt.prompts[step]}} +.prompt-text {{prompt.prompts[step].prompt}} input.form-control.mt-2( #input, diff --git a/tabby-ssh/src/components/keyboardInteractiveAuthPanel.component.ts b/tabby-ssh/src/components/keyboardInteractiveAuthPanel.component.ts index 35d274e8..6ff5be5a 100644 --- a/tabby-ssh/src/components/keyboardInteractiveAuthPanel.component.ts +++ b/tabby-ssh/src/components/keyboardInteractiveAuthPanel.component.ts @@ -15,7 +15,7 @@ export class KeyboardInteractiveAuthComponent { @ViewChild('input') input: ElementRef isPassword (): boolean { - return this.prompt.prompts[this.step].toLowerCase().includes('password') + return this.prompt.prompts[this.step].prompt.toLowerCase().includes('password') || !this.prompt.prompts[this.step].echo } previous (): void { diff --git a/tabby-ssh/src/session/ssh.ts b/tabby-ssh/src/session/ssh.ts index 292268b4..4ab50dfa 100644 --- a/tabby-ssh/src/session/ssh.ts +++ b/tabby-ssh/src/session/ssh.ts @@ -11,6 +11,7 @@ import { ConfigService, FileProvidersService, HostAppService, NotificationsServi import { BaseSession } from 'tabby-terminal' import { Socket } from 'net' import { Client, ClientChannel, SFTPWrapper } from 'ssh2' +import type { Prompt } from 'ssh2-streams' import { Subject, Observable } from 'rxjs' import { ProxyCommandStream, SocksProxyStream } from '../services/ssh.service' import { PasswordStorageService } from '../services/passwordStorage.service' @@ -34,7 +35,7 @@ export class KeyboardInteractivePrompt { constructor ( public name: string, public instruction: string, - public prompts: string[], + public prompts: Prompt[], private callback: (_: string[]) => void, ) { } @@ -213,7 +214,7 @@ export class SSHSession extends BaseSession { this.emitKeyboardInteractivePrompt(new KeyboardInteractivePrompt( name, instructions, - prompts.map(x => x.prompt), + prompts, finish, )) }))