Restore correct behavior of socket:get_info() and others

Since Nmap 7.93, requesting certain operations on an unconnected NSE
socket would result in a Lua error being thrown instead of the (nil,
message) return that was expected. vnc-info and the http.lua library
both use socket:get_info() as a check for whether the socket is
connected. This restores the expected behavior. Fixes #3424
This commit is contained in:
dmiller 2026-08-21 01:29:35 +00:00
parent 84420aa300
commit 042376289d

View file

@ -445,9 +445,9 @@ static nse_nsock_udata *check_nsock_udata (lua_State *L, int idx, bool open)
#define NSOCK_UDATA_ENSURE_OPEN(L, nu) \
do { \
if (nu->nsiod == NULL) \
return luaL_error(L, "socket must be connected"); \
return nseU_safeerror(L, "socket must be connected"); \
if (nu->af == NSE_AF_PCAP) \
return luaL_error(L, "invalid operation on pcap socket"); \
return nseU_safeerror(L, "invalid operation on pcap socket"); \
} while (0)
static int l_loop (lua_State *L)