1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-29 19:09:01 +00:00

Handle libssh2 errors on connect. Closes #2616. Fixes #1014

This commit is contained in:
dmiller
2024-10-04 18:21:25 +00:00
parent b507356091
commit f1325d7c6f
5 changed files with 22 additions and 15 deletions

View File

@@ -61,8 +61,9 @@ end
function action (host, port)
local conn = libssh2_util.SSHConnection:new()
if not conn:connect(host, port) then
return "Failed to connect to ssh server"
local status, err = helper:connect_pcall(host, port)
if not status then
return "Failed to connect to ssh server: " .. err
end
if username and password and cmd then
if not conn:password_auth(username, password) then