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.
This commit is contained in:
quamrulmina 2015-10-28 00:31:24 -05:00
parent d4c8ef9ac5
commit e743b54a61
2 changed files with 5 additions and 8 deletions

View File

@ -51,7 +51,6 @@
// items used from other modules
int NetWriteString(char* pszString, size_t cbString);
TelParams Parameters;
int lftocrlf = 0;
extern int ScreenX;
extern int ScreenY;
@ -407,12 +406,10 @@ void ConSetExtendedMode(int iFunction, BOOL bEnable)
case 20: // LNM Mode CSI 20h
if (bEnable){
VTMode |= MODE_LNM;
Parameters.nReceiveCRLF = ENUM_LF;
lftocrlf = 1;
Parameters.nReceiveCRLF = ENUM_CRLF;
}else{
VTMode &= ~MODE_LNM;
Parameters.nReceiveCRLF = ENUM_CRLF;
lftocrlf = 0;
Parameters.nReceiveCRLF = ENUM_LF;
}
break;
case 25:

View File

@ -77,7 +77,7 @@ void ConInputInitParams(void)
Parameters.szDebugInputFile = NULL;
Parameters.fDebugWait= FALSE;
Parameters.nReceiveCRLF = ENUM_LF;
Parameters.fSendCROnly = TRUE; //FALSE;
//Parameters.fSendCROnly = TRUE; //FALSE;
Parameters.sleepChar = '`';
Parameters.menuChar = '\035'; // CTRL-]
Parameters.pAltKey = "\x01"; // default
@ -192,8 +192,8 @@ int ReadConsoleForTermEmul( HANDLE hInput, char *destin, int destinlen)
switch (InputRecord.Event.KeyEvent.uChar.UnicodeChar)
{
case 0xd:
if (pParams->fSendCROnly)
NetWriteString2(pParams->Socket, "\r", 1, 0);
if (pParams->nReceiveCRLF == ENUM_LF)
NetWriteString2(pParams->Socket, "\n", 1, 0);
else
NetWriteString2(pParams->Socket, "\r\n", 2, 0);
break;