From d28a8497d48744551bf98a6baece9c4130036e0d Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Thu, 8 Apr 2004 05:36:17 +0000 Subject: [PATCH] Fix for telnet gateway to UNIX telnetd (using unixgate.bin) by sending "DONT TERMINAL TYPE" Telnet command before passing through traffic from the remote server (allowing renegotiation of the Terminal Type from the telnet client). --- src/sbbs3/telgate.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/sbbs3/telgate.cpp b/src/sbbs3/telgate.cpp index faa73f5616..70f843345d 100644 --- a/src/sbbs3/telgate.cpp +++ b/src/sbbs3/telgate.cpp @@ -133,6 +133,9 @@ void sbbs_t::telnet_gate(char* destaddr, ulong mode) l=p-(char*)buf; sendsocket(remote_socket,(char*)buf,l); } + + /* This is required for gating to Unix telnetd */ + send_telnet_cmd(TELNET_DONT,TELNET_TERM_TYPE); // Re-negotiation of terminal type /* Text/NVT mode by default */ send_telnet_cmd(TELNET_DONT,TELNET_BINARY); @@ -143,6 +146,16 @@ void sbbs_t::telnet_gate(char* destaddr, ulong mode) gettimeleft(); rd=RingBufRead(&inbuf,buf,sizeof(buf)); if(rd) { +#if 0 + if(memchr(buf,TELNET_IAC,rd)) { + char dump[2048]; + dump[0]; + p=dump; + for(int i=0;i<rd;i++) + p+=sprintf(p,"%u ",buf[i]); + lprintf(LOG_DEBUG,"Node %d Telnet cmd from client: %s", cfg.node_num, dump); + } +#endif if(!(telnet_mode&TELNET_MODE_BIN_RX)) { if(*buf==0x1d) { // ^] save_console=console; @@ -228,6 +241,16 @@ void sbbs_t::telnet_gate(char* destaddr, ulong mode) lprintf(LOG_INFO,"Node %d Telnet gate disconnected",cfg.node_num); break; } +#if 0 + if(memchr(buf,TELNET_IAC,rd)) { + char dump[2048]; + dump[0]; + p=dump; + for(int i=0;i<rd;i++) + p+=sprintf(p,"%u ",buf[i]); + lprintf(LOG_DEBUG,"Node %d Telnet cmd from remote: %s", cfg.node_num, dump); + } +#endif RingBufWrite(&outbuf,buf,rd); } console&=~CON_RAW_IN; -- GitLab