From 889e58c0562b65e59407593afc01406f98773ef0 Mon Sep 17 00:00:00 2001 From: quamrulmina Date: Wed, 28 Oct 2015 18:11:52 -0500 Subject: [PATCH] Fix ssh client not executing shell cmd given as argument "ssh user@host whoami" now works and will show the whoami command output. sshd server was fine but ssh client was not working. --- session.c | 2 +- ssh.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/session.c b/session.c index f86f1ed..8cd6124 100644 --- a/session.c +++ b/session.c @@ -877,7 +877,7 @@ do_exec_no_pty(Session *s, const char *command) GetUserName(name, &size); - if (!(s -> is_subsystem)) { + if ( (!s -> is_subsystem) && (s ->ttyfd != -1)) { // Send to the remote client ANSI/VT Sequence so that they send us CRLF in place of LF char *inittermseq = "\033[20h\033[?7h\0" ; // LFtoCRLF AUTOWRAPON Channel *c=channel_by_id ( s->chanid ); diff --git a/ssh.c b/ssh.c index 0ee3df2..c4ca475 100644 --- a/ssh.c +++ b/ssh.c @@ -1534,6 +1534,10 @@ main(int ac, char **av) HANDLE hInput = GetStdHandle(STD_INPUT_HANDLE); ConInit( STD_OUTPUT_HANDLE, TRUE ); //init the output console surface for us to write } + else { + extern int glob_itissshclient; + glob_itissshclient = 1; // tell our contrib/win32/win32compat/socket.c code it is for ssh client side + } #endif exit_status = compat20 ? ssh_session2() : ssh_session();