Skip to content
Snippets Groups Projects
Commit c4644bf9 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Initialize telnet options when passed -h option (withouth -l)

As requested by Fzf (FQBBS):

  When SVDM uses an inherited socket (the -h option) no telnet negotiations
  are done.  As a result, the connection is assumed to be in ASCII mode and
  server side CR characters are translated to CR/LF.  Since most programs are
  already transmitting a CR/LF this gets translated to CR/LF/LF with the
  expected results.  When using an external socket in telnet mode, could SVDM
  set the telnet.local_option and telnet.remote_option variables as so:

    A. Assume both remote and local have already suppressed GA and set the two
       options accordingly

    B. Set the remote telnet echo option to off and set the local telnet echo
       to follow the ServerEcho option from the .INI file

    C. Set both remote and local BINARY_TX options to follow the ServerBinary
       option from the .INI file
parent f2a017ec
Branches
Tags
1 merge request!455Update branch with changes from master
......@@ -720,6 +720,23 @@ connected:
return connected(modem);
}
void init_telnet_options()
{
if(mode == TELNET) {
ZERO_VAR(telnet);
if(cfg.server_echo) {
/* Disable Telnet Terminal Echo */
request_telnet_opt(TELNET_WILL,TELNET_ECHO);
}
if(cfg.server_binary) {
/* Will send in binary mode (no CR->CRLF expansion on receiver side) */
request_telnet_opt(TELNET_WILL,TELNET_BINARY_TX);
}
/* Will suppress Go Ahead */
request_telnet_opt(TELNET_WILL,TELNET_SUP_GA);
}
}
char* answer(struct modem* modem)
{
if(listening_sock == INVALID_SOCKET)
......@@ -742,19 +759,7 @@ char* answer(struct modem* modem)
fclose(fp);
}
}
if(mode == TELNET) {
ZERO_VAR(telnet);
if(cfg.server_echo) {
/* Disable Telnet Terminal Echo */
request_telnet_opt(TELNET_WILL,TELNET_ECHO);
}
if(cfg.server_binary) {
/* Will send in binary mode (no CR->CRLF expansion on receiver side) */
request_telnet_opt(TELNET_WILL,TELNET_BINARY_TX);
}
/* Will suppress Go Ahead */
request_telnet_opt(TELNET_WILL,TELNET_SUP_GA);
}
init_telnet_options();
putcom(cfg.answer_banner, strlen(cfg.answer_banner));
return connected(modem);
}
......@@ -1275,9 +1280,10 @@ int main(int argc, char** argv)
_beginthread(listen_thread, /* stack_size: */0, &modem);
} else {
if(sock != INVALID_SOCKET) {
if(sock != INVALID_SOCKET) { // -h option specified without -l
setsockopts(sock);
connected(&modem);
init_telnet_options();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment