Преглед изворни кода

[telnet_server]add terminal type

balbekova пре 6 година
родитељ
комит
c8c5d0e54c
1 измењених фајлова са 14 додато и 0 уклоњено
  1. 14 0
      modules/Telnet_Server/telnet_server.c

+ 14 - 0
modules/Telnet_Server/telnet_server.c

@@ -106,6 +106,8 @@ user_level_t telnet_code_auth = USER;
 
 telnetd_state_t auth_tlnt_srvr_param[NUMBER_TELNET_CONNECT];
 
+uint8_t type_term = 0;
+
 static int32_t lSocket;
 static int8_t *pcOutputString;
 static bool flagTelnetChange = false;
@@ -228,6 +230,11 @@ static void telnetd_input(telnetd_state_t *s)
 /*-----------------------------------------------------------------------------------*/
 static void getchar(telnetd_state_t *s)
 {
+	if(type_term == 1){
+		send( s->num_connect, &s->buf[s->bufptr], 1, 0 );
+	}
+
+
   if(s->buf[s->bufptr] == ISO_nl ||
 	s->buf[s->bufptr] == 0) {
 	s->bufptr = 0;
@@ -271,6 +278,13 @@ void parseopt(telnetd_state_t *ts, uint8_t code, uint8_t option)
 
   switch (option) {
     case TELOPT_ECHO:
+    	if (code == TELNET_WONT) {
+    		type_term = 0;
+    	}
+    	else if (code == TELNET_WILL ){
+    		type_term = 1;
+    	}
+    	break;
     case TELOPT_SUPPRESS_GO_AHEAD:
     case TELOPT_LINEMODE:
     case TELOPT_NAWS: