Skip to content

Commit e743b54

Browse files
committed
Fix ssh client to generate LF or CRLF correctly
Typically LF is sent when Return key is hit. But for sshd servers that sent us via ANSI escape sequence that CRLF is to be sent, ssh.exe client will do so which is used commonly used by sshd servers in Windows - like our own win32 port sshd.
1 parent d4c8ef9 commit e743b54

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

contrib/win32/win32compat/ansiprsr.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
// items used from other modules
5252
int NetWriteString(char* pszString, size_t cbString);
5353
TelParams Parameters;
54-
int lftocrlf = 0;
5554

5655
extern int ScreenX;
5756
extern int ScreenY;
@@ -407,12 +406,10 @@ void ConSetExtendedMode(int iFunction, BOOL bEnable)
407406
case 20: // LNM Mode CSI 20h
408407
if (bEnable){
409408
VTMode |= MODE_LNM;
410-
Parameters.nReceiveCRLF = ENUM_LF;
411-
lftocrlf = 1;
409+
Parameters.nReceiveCRLF = ENUM_CRLF;
412410
}else{
413411
VTMode &= ~MODE_LNM;
414-
Parameters.nReceiveCRLF = ENUM_CRLF;
415-
lftocrlf = 0;
412+
Parameters.nReceiveCRLF = ENUM_LF;
416413
}
417414
break;
418415
case 25:

contrib/win32/win32compat/tncon.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void ConInputInitParams(void)
7777
Parameters.szDebugInputFile = NULL;
7878
Parameters.fDebugWait= FALSE;
7979
Parameters.nReceiveCRLF = ENUM_LF;
80-
Parameters.fSendCROnly = TRUE; //FALSE;
80+
//Parameters.fSendCROnly = TRUE; //FALSE;
8181
Parameters.sleepChar = '`';
8282
Parameters.menuChar = '\035'; // CTRL-]
8383
Parameters.pAltKey = "\x01"; // default
@@ -192,8 +192,8 @@ int ReadConsoleForTermEmul( HANDLE hInput, char *destin, int destinlen)
192192
switch (InputRecord.Event.KeyEvent.uChar.UnicodeChar)
193193
{
194194
case 0xd:
195-
if (pParams->fSendCROnly)
196-
NetWriteString2(pParams->Socket, "\r", 1, 0);
195+
if (pParams->nReceiveCRLF == ENUM_LF)
196+
NetWriteString2(pParams->Socket, "\n", 1, 0);
197197
else
198198
NetWriteString2(pParams->Socket, "\r\n", 2, 0);
199199
break;

0 commit comments

Comments
 (0)