From 7c648687415d2d8d0439e3bd2e54ca8f4d4e2f2c Mon Sep 17 00:00:00 2001 From: david Date: Wed, 9 Nov 2011 01:41:34 +0000 Subject: [PATCH] Fix logic errors in comm.opencon when data is not supplied. It looks like this code never worked, because the debug message was using a nonexistent function (nsedebug.print_debug). --- nselib/comm.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nselib/comm.lua b/nselib/comm.lua index 10d8d12be..52e055c6b 100644 --- a/nselib/comm.lua +++ b/nselib/comm.lua @@ -223,12 +223,12 @@ local function opencon(host, port, protocol, data, opts) local response, early_resp; if opts and opts.recv_before then status, early_resp = read(sd, opts) end - if #data > 0 then + if data and #data > 0 then sd:send(data) status, response = sd:receive() else - if not opts and opts.recv_before then - nsedebug.print_debug("Using comm.tryssl without first data payload and recv_first." .. + if not (opts and opts.recv_before) then + stdnse.print_debug("Using comm.tryssl without first data payload and recv_first." .. "\nImpossible to test the connection for the correct protocol!") end response = early_resp