1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-12 02:39:03 +00:00

Use sock:receive when neither the "lines" nor "bytes" option is given to

comm.exchange. Previously it was acting as if it got bytes=1, which
could return as few as one bytes. sock:receive will read until timeout
or EOF.
This commit is contained in:
david
2010-12-29 22:44:03 +00:00
parent 1046dcab57
commit d9d47eb93d

View File

@@ -52,11 +52,6 @@ local setup_connect = function(host, port, opts)
return status, err
end
-- If nothing is given, specify bytes=1 so NSE reads everything
if not opts.lines and not opts.bytes then
opts.bytes = 1
end
return true, sock
end
@@ -68,10 +63,15 @@ local read = function(sock, opts)
return status, response
end
if opts.bytes then
status, response = sock:receive_bytes(opts.bytes)
return status, response
end
status, response = sock:receive()
return status, response
end
--- This function simply connects to the specified port number on the
-- specified host and returns any data received.
--