mirror of
https://github.com/20kdc/OC-KittenOS.git
synced 2024-11-23 10:58:06 +11:00
svc-t: Properly ignore TELNET subnegotiations
This commit is contained in:
parent
7c70a1128c
commit
3ed1cebe25
@ -155,6 +155,7 @@ end
|
|||||||
|
|
||||||
local tvBuildingCmd = ""
|
local tvBuildingCmd = ""
|
||||||
local tvBuildingUTF = ""
|
local tvBuildingUTF = ""
|
||||||
|
local tvSubnegotiation = false
|
||||||
local function incoming(s)
|
local function incoming(s)
|
||||||
tvBuildingCmd = tvBuildingCmd .. s
|
tvBuildingCmd = tvBuildingCmd .. s
|
||||||
-- Flush Cmd
|
-- Flush Cmd
|
||||||
@ -168,7 +169,13 @@ local function incoming(s)
|
|||||||
-- Command Lengths
|
-- Command Lengths
|
||||||
if cmd >= 251 and cmd <= 254 then cmdLen = 3 end
|
if cmd >= 251 and cmd <= 254 then cmdLen = 3 end
|
||||||
if #tvBuildingCmd < cmdLen then break end
|
if #tvBuildingCmd < cmdLen then break end
|
||||||
if cmd == 251 and param == 1 then
|
if cmd == 240 then
|
||||||
|
-- SE
|
||||||
|
tvSubnegotiation = false
|
||||||
|
elseif cmd == 250 then
|
||||||
|
-- SB
|
||||||
|
tvSubnegotiation = true
|
||||||
|
elseif cmd == 251 and param == 1 then
|
||||||
-- WILL ECHO (respond with DO ECHO, disable line editing)
|
-- WILL ECHO (respond with DO ECHO, disable line editing)
|
||||||
-- test using io.write("\xFF\xFB\x01")
|
-- test using io.write("\xFF\xFB\x01")
|
||||||
for _, v in pairs(sendSigs) do
|
for _, v in pairs(sendSigs) do
|
||||||
@ -188,11 +195,15 @@ local function incoming(s)
|
|||||||
v("telnet", res)
|
v("telnet", res)
|
||||||
end
|
end
|
||||||
elseif cmd == 255 then
|
elseif cmd == 255 then
|
||||||
tvBuildingUTF = tvBuildingUTF .. "\xFF"
|
if not tvSubnegotiation then
|
||||||
|
tvBuildingUTF = tvBuildingUTF .. "\xFF"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
tvBuildingCmd = tvBuildingCmd:sub(cmdLen + 1)
|
tvBuildingCmd = tvBuildingCmd:sub(cmdLen + 1)
|
||||||
else
|
else
|
||||||
tvBuildingUTF = tvBuildingUTF .. tvBuildingCmd:sub(1, 1)
|
if not tvSubnegotiation then
|
||||||
|
tvBuildingUTF = tvBuildingUTF .. tvBuildingCmd:sub(1, 1)
|
||||||
|
end
|
||||||
tvBuildingCmd = tvBuildingCmd:sub(2)
|
tvBuildingCmd = tvBuildingCmd:sub(2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user