| 
					
				 | 
			
			
				@@ -35,14 +35,10 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #include "parameters.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #include "CLI_Commands.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #include "CLI_Parameters.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-#include "telnet_server.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include "cli.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #include "netconf.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #include "control_symbol.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-extern state_telnet_server_t telnetState; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-extern uint8_t id_change_pwd; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const int8_t *const pcInvalidCommand = ( int8_t * ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     "Неправильно введены параметры команды.  Введите \"help\" для просмотра списка поддерживаемых команд.\r\n\r\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const int8_t *const pcPermissionDenied = ( int8_t * ) "Отказ в доступе!\r\n\r\n"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -154,105 +150,103 @@ const char *user_args_list[] = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 extern SETTINGS_t sSettings; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-extern user_level_t telnet_code_auth; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the controller's information command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskInfoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskInfoCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the reboot command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskRebootCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskRebootCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the systime command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskSystimeCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskSystimeCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the ntp command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskNTPCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskNTPCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the network command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskNetworkCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskNetworkCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the snmp command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskSNMPCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskSNMPCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the AKB command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskAKBCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskAKBCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the alarm command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskAlarmCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskAlarmCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef HARDWARE_BT6709 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the notification command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskNotificationCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskNotificationCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the whitelist command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskWhiteListCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskWhiteListCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the change password command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskUserCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskUserCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the config command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskConfigCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskConfigCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the netconfig command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskNetConfigCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskNetConfigCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the history command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskHistoryCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskHistoryCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the sensor info command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskSensorCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskSensorCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the firmware download http command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskUploadCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskUploadCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the ups command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskUPSCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskUPSCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* Structure that defines the "info" command line command.   This 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -506,7 +500,7 @@ void vRegisterCLICommands( void ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /*-----------------------------------------------------------*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskInfoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskInfoCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int8_t *pcParameterString; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     signed portBASE_TYPE xParameterStringLength, xReturn; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -631,7 +625,7 @@ static portBASE_TYPE prvTaskInfoCommand( int8_t *pcWriteBuffer, size_t xWriteBuf 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (control_string_en_digit(str, strlen(str))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             switch (i) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 case INFO_DEV_NAME: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (telnet_code_auth == ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (cli_state->user_id == ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         str[19] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         SetNameDeviceStr(str); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -639,7 +633,7 @@ static portBASE_TYPE prvTaskInfoCommand( int8_t *pcWriteBuffer, size_t xWriteBuf 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 case INFO_ADDRESS: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (telnet_code_auth == ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (cli_state->user_id == ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         str[109] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         SetLocation(str); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -647,7 +641,7 @@ static portBASE_TYPE prvTaskInfoCommand( int8_t *pcWriteBuffer, size_t xWriteBuf 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 case INFO_OWNER: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (telnet_code_auth == ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (cli_state->user_id == ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         str[49] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         SetOwner(str); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -655,7 +649,7 @@ static portBASE_TYPE prvTaskInfoCommand( int8_t *pcWriteBuffer, size_t xWriteBuf 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 case INFO_COMMENTS: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (telnet_code_auth == ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (cli_state->user_id == ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         str[109] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         SetComment(str); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -679,7 +673,7 @@ static portBASE_TYPE prvTaskInfoCommand( int8_t *pcWriteBuffer, size_t xWriteBuf 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return xReturn; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskRebootCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskRebootCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -690,7 +684,7 @@ static portBASE_TYPE prvTaskRebootCommand( int8_t *pcWriteBuffer, size_t xWriteB 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ( void ) pcCommandString; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ( void ) xWriteBufferLen; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (telnet_code_auth != ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (cli_state->user_id != ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -706,7 +700,7 @@ static portBASE_TYPE prvTaskRebootCommand( int8_t *pcWriteBuffer, size_t xWriteB 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskSystimeCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskSystimeCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int8_t *pcParameterString; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -751,7 +745,7 @@ static portBASE_TYPE prvTaskSystimeCommand( int8_t *pcWriteBuffer, size_t xWrite 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         strings to return after this one and pdFALSE should be returned. */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         xReturn = pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (telnet_code_auth != ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (cli_state->user_id != ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -875,7 +869,7 @@ static portBASE_TYPE prvTaskSystimeCommand( int8_t *pcWriteBuffer, size_t xWrite 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the ntp command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskNTPCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskNTPCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int8_t *pcParameterString; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     signed portBASE_TYPE xParameterStringLength, xReturn; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -913,7 +907,7 @@ static portBASE_TYPE prvTaskNTPCommand( int8_t *pcWriteBuffer, size_t xWriteBuff 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (telnet_code_auth != ADMIN && i != ARG_NTP_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (cli_state->user_id != ADMIN && i != ARG_NTP_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1063,7 +1057,7 @@ static portBASE_TYPE prvTaskNTPCommand( int8_t *pcWriteBuffer, size_t xWriteBuff 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the network command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskNetworkCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskNetworkCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int8_t *pcParameterString; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1095,7 +1089,7 @@ static portBASE_TYPE prvTaskNetworkCommand( int8_t *pcWriteBuffer, size_t xWrite 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (telnet_code_auth != ADMIN && i != ARG_NETWORK_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (cli_state->user_id != ADMIN && i != ARG_NETWORK_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1193,7 +1187,7 @@ static portBASE_TYPE prvTaskNetworkCommand( int8_t *pcWriteBuffer, size_t xWrite 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the snmp command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskSNMPCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskSNMPCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int8_t *pcParameterString; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     signed portBASE_TYPE xParameterStringLength, xReturn; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1226,7 +1220,7 @@ static portBASE_TYPE prvTaskSNMPCommand( int8_t *pcWriteBuffer, size_t xWriteBuf 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (telnet_code_auth != ADMIN && i != ARG_SNMP_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (cli_state->user_id != ADMIN && i != ARG_SNMP_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1355,7 +1349,7 @@ static portBASE_TYPE prvTaskSNMPCommand( int8_t *pcWriteBuffer, size_t xWriteBuf 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the akb command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskAKBCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskAKBCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int8_t *pcParameterString; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     signed portBASE_TYPE xParameterStringLength, xReturn; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1389,7 +1383,7 @@ static portBASE_TYPE prvTaskAKBCommand( int8_t *pcWriteBuffer, size_t xWriteBuff 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (telnet_code_auth != ADMIN && i != ARG_AKB_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (cli_state->user_id != ADMIN && i != ARG_AKB_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1544,7 +1538,7 @@ static portBASE_TYPE prvTaskAKBCommand( int8_t *pcWriteBuffer, size_t xWriteBuff 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the alarm command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskAlarmCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskAlarmCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int8_t *pcParameterString; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     signed portBASE_TYPE xParameterStringLength, xReturn; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1577,7 +1571,7 @@ static portBASE_TYPE prvTaskAlarmCommand( int8_t *pcWriteBuffer, size_t xWriteBu 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (telnet_code_auth != ADMIN && i != ARG_ALARM_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (cli_state->user_id != ADMIN && i != ARG_ALARM_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1796,7 +1790,7 @@ static portBASE_TYPE prvTaskAlarmCommand( int8_t *pcWriteBuffer, size_t xWriteBu 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the notification command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskNotificationCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskNotificationCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int8_t *pcParameterString; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1832,7 +1826,7 @@ static portBASE_TYPE prvTaskNotificationCommand( int8_t *pcWriteBuffer, size_t x 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (telnet_code_auth != ADMIN && i != ARG_NOTIFICATION_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (cli_state->user_id != ADMIN && i != ARG_NOTIFICATION_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1908,7 +1902,7 @@ static portBASE_TYPE prvTaskNotificationCommand( int8_t *pcWriteBuffer, size_t x 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the whitelist command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskWhiteListCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskWhiteListCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int8_t *pcParameterString; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1945,7 +1939,7 @@ static portBASE_TYPE prvTaskWhiteListCommand( int8_t *pcWriteBuffer, size_t xWri 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (telnet_code_auth != ADMIN && i != ARG_WHITELIST_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (cli_state->user_id != ADMIN && i != ARG_WHITELIST_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2054,7 +2048,7 @@ static portBASE_TYPE prvTaskWhiteListCommand( int8_t *pcWriteBuffer, size_t xWri 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the change password command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskUserCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskUserCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int8_t *pcParameterString; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     signed portBASE_TYPE xParameterStringLength, xReturn; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2072,7 +2066,7 @@ static portBASE_TYPE prvTaskUserCommand( int8_t *pcWriteBuffer, size_t xWriteBuf 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     memset(pcWriteBuffer, 0, configCOMMAND_INT_MAX_OUTPUT_SIZE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (telnet_code_auth != ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (cli_state->user_id != ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2109,6 +2103,8 @@ static portBASE_TYPE prvTaskUserCommand( int8_t *pcWriteBuffer, size_t xWriteBuf 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             strncat(temp_str, ( const char * ) pcParameterString, strlen(( const char * ) pcParameterString)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // FIXME proper context 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#if 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (user_id = 0; user_id < MAX_WEB_USERS; user_id++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 GetUserLogin(user_id, WebLogin, &valueLen); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2119,13 +2115,14 @@ static portBASE_TYPE prvTaskUserCommand( int8_t *pcWriteBuffer, size_t xWriteBuf 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     /* Login and pass are valid */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     id_change_pwd = user_id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcChangePWDHeader, strlen( ( char * ) pcChangePWDHeader ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    telnetState = TELNET_CHANGE_PWD; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    telnetState = CLI_CHANGE_PWD; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (telnetState != TELNET_CHANGE_PWD) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (telnetState != CLI_CHANGE_PWD) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#endif 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) ); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2140,7 +2137,7 @@ static portBASE_TYPE prvTaskUserCommand( int8_t *pcWriteBuffer, size_t xWriteBuf 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the config command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskConfigCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskConfigCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int8_t *pcParameterString; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2177,7 +2174,7 @@ static portBASE_TYPE prvTaskConfigCommand( int8_t *pcWriteBuffer, size_t xWriteB 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (telnet_code_auth != ADMIN && i != ARG_CONFIG_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (cli_state->user_id != ADMIN && i != ARG_CONFIG_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2274,7 +2271,7 @@ static portBASE_TYPE prvTaskConfigCommand( int8_t *pcWriteBuffer, size_t xWriteB 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the config command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskNetConfigCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskNetConfigCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int8_t *pcParameterString; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2303,7 +2300,7 @@ static portBASE_TYPE prvTaskNetConfigCommand( int8_t *pcWriteBuffer, size_t xWri 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (telnet_code_auth != ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (cli_state->user_id != ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2347,7 +2344,7 @@ static portBASE_TYPE prvTaskNetConfigCommand( int8_t *pcWriteBuffer, size_t xWri 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the history command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskHistoryCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskHistoryCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int8_t *pcParameterString; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2498,7 +2495,7 @@ static portBASE_TYPE prvTaskHistoryCommand( int8_t *pcWriteBuffer, size_t xWrite 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the sensor info command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskSensorCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskSensorCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int8_t *pcParameterString; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2586,7 +2583,7 @@ static portBASE_TYPE prvTaskSensorCommand( int8_t *pcWriteBuffer, size_t xWriteB 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         switch (i) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef HARDWARE_BT6707 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             case ARG_SENSOR_SETUP: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (telnet_code_auth != ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (cli_state->user_id != ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2689,7 +2686,7 @@ static portBASE_TYPE prvTaskSensorCommand( int8_t *pcWriteBuffer, size_t xWriteB 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the firmware download http command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskUploadCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskUploadCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     static bool start_update = true; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2699,7 +2696,7 @@ static portBASE_TYPE prvTaskUploadCommand( int8_t *pcWriteBuffer, size_t xWriteB 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ( void ) pcCommandString; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ( void ) xWriteBufferLen; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (telnet_code_auth != ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (cli_state->user_id != ADMIN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2718,7 +2715,7 @@ static portBASE_TYPE prvTaskUploadCommand( int8_t *pcWriteBuffer, size_t xWriteB 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Implements the ups command. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static portBASE_TYPE prvTaskUPSCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static portBASE_TYPE prvTaskUPSCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     int8_t *pcParameterString; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     signed portBASE_TYPE xParameterStringLength, xReturn; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2735,7 +2732,7 @@ static portBASE_TYPE prvTaskUPSCommand( int8_t *pcWriteBuffer, size_t xWriteBuff 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     memset(pcWriteBuffer, 0, configCOMMAND_INT_MAX_OUTPUT_SIZE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (telnet_code_auth != ADMIN && i != ARG_CONFIG_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (cli_state->user_id != ADMIN && i != ARG_CONFIG_INFO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return pdFALSE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 |