oops again

This commit is contained in:
kepler155c@gmail.com 2019-07-01 20:39:34 -04:00
parent cd7122921f
commit aec5ac0121
2 changed files with 3 additions and 5 deletions

View File

@ -13,10 +13,9 @@ local function trustConnection(socket)
if not password then
socket:write({ msg = 'No password has been set' })
else
pcall(function()
data = Crypto.decrypt(data, password)
end)
if data and data.pk and data.dh == socket.dhost then
local s
s, data = pcall(Crypto.decrypt, data, password)
if s and data and data.pk and data.dh == socket.dhost then
local trustList = Util.readTable('usr/.known_hosts') or { }
trustList[data.dh] = data.pk
Util.writeTable('usr/.known_hosts', trustList)

View File

@ -210,7 +210,6 @@ function Socket.server(port, options)
local _, _, sport, dport, msg = os.pullEvent('modem_message')
if sport == port and
msg and
type(msg) == 'table' and
msg.dhost == os.getComputerID() and
msg.type == 'OPEN' then