- if client.status == host.status.password then
- if client.buffer == password then
- client:send( IAC..WONT..ECHO.."\r\nWelcome, Master\r\n" )
- client.buffer = ""
+ -- loop on all commands (might have more than one commands seperated by '\n'
+ local returned_values = ""
+ while not (client.buffer == "") do
+ -- pick the first command
+ local commands = ""
+ if string.find(client.buffer, "\n") then
+ commands = string.sub(client.buffer, string.find(client.buffer, "\n") + 1)
+ client.buffer = string.sub(client.buffer, 0, string.find(client.buffer, "\n") - 1)
+ end
+ local cmd = client.buffer
+
+ if client.status == host.status.password then
+ if client.buffer == password then
+ client:send( IAC..WONT..ECHO.."\r\nWelcome, Master\r\n" )
+ client.buffer = ""
+ client:switch_status( host.status.write )
+ else
+ client:send( "\r\nWrong password\r\nPassword: " )
+ client.buffer = ""
+ end
+ elseif client_command( client ) then