mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-21 21:14:51 +02:00
Add ANSI processing in ssh client pty code to detect LF to CRLF mode
Whether LF should be changed to CR-LF is determined by what the remote sshd server wants. Sequences like ESC[20h is sent by sshd servers in pty ANSI mode. Unix servers usually want LF and Windows servers CR-LF. Added simple ANSI data check now for pty use in interactive mode. Need to expand to simple ANSI engine in future for processing other ANSI terminal attributes.
This commit is contained in:
parent
522af1564b
commit
545dda2c8b
16
channels.c
16
channels.c
@ -2395,8 +2395,9 @@ channel_output_poll(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef WIN32_FIXME
|
||||||
|
int lftocrlf = 0;
|
||||||
|
#endif
|
||||||
/* -- protocol input */
|
/* -- protocol input */
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
@ -2452,6 +2453,17 @@ channel_input_data(int type, u_int32_t seq, void *ctxt)
|
|||||||
}
|
}
|
||||||
c->local_window -= win_len;
|
c->local_window -= win_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32_FIXME
|
||||||
|
if ( (c->client_tty) && (data_len >= 5) ) {
|
||||||
|
if ( data[0] == '\033' ) { // escape char octal 33, decimal 27
|
||||||
|
if ( (data[1] == '[') && (data[2]== '2') && (data[3]== '0') && ( data[4]== 'h' )) {
|
||||||
|
lftocrlf = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (c->datagram)
|
if (c->datagram)
|
||||||
buffer_put_string(&c->output, data, data_len);
|
buffer_put_string(&c->output, data, data_len);
|
||||||
else
|
else
|
||||||
|
@ -1320,6 +1320,14 @@ process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr,
|
|||||||
* and append it to the buffer.
|
* and append it to the buffer.
|
||||||
*/
|
*/
|
||||||
last_was_cr = (ch == '\r' || ch == '\n');
|
last_was_cr = (ch == '\r' || ch == '\n');
|
||||||
|
#ifdef WIN32_FIXME
|
||||||
|
extern int lftocrlf ; // defined in channels.c file's channel_input_data() function for now
|
||||||
|
if ( (lftocrlf == 1) && ( ch == '\n') ) {
|
||||||
|
// add a \r before \n if sshd server sent us ESC[20h during initial tty mode setting
|
||||||
|
buffer_put_char(bin, '\r');
|
||||||
|
bytes++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
buffer_put_char(bin, ch);
|
buffer_put_char(bin, ch);
|
||||||
bytes++;
|
bytes++;
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
#define SSH_VERSION "OpenSSH_7.1"
|
#define SSH_VERSION "OpenSSH_7.1"
|
||||||
|
|
||||||
#define SSH_PORTABLE "p1 Microsoft Pragma Win32 port Sep 30 2015"
|
#define SSH_PORTABLE "p1 Microsoft Pragma Win32 port Oct 7 2015"
|
||||||
#define SSH_RELEASE SSH_VERSION SSH_PORTABLE
|
#define SSH_RELEASE SSH_VERSION SSH_PORTABLE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user