mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Handle immediate write errors in NSE.
This commit is contained in:
@@ -351,6 +351,7 @@ static void status (lua_State *L, enum nse_status status)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* callback for connect and write events */
|
||||||
static void callback (nsock_pool nsp, nsock_event nse, void *ud)
|
static void callback (nsock_pool nsp, nsock_event nse, void *ud)
|
||||||
{
|
{
|
||||||
nse_nsock_udata *nu = (nse_nsock_udata *) ud;
|
nse_nsock_udata *nu = (nse_nsock_udata *) ud;
|
||||||
@@ -598,6 +599,10 @@ static int l_send (lua_State *L)
|
|||||||
const char *string = luaL_checklstring(L, 2, &size);
|
const char *string = luaL_checklstring(L, 2, &size);
|
||||||
trace(nu->nsiod, hexify((unsigned char *) string, size).c_str(), TO);
|
trace(nu->nsiod, hexify((unsigned char *) string, size).c_str(), TO);
|
||||||
nsock_write(nsp, nu->nsiod, callback, nu->timeout, nu, string, size);
|
nsock_write(nsp, nu->nsiod, callback, nu->timeout, nu, string, size);
|
||||||
|
if (nu->action == NU_ACTION_IMMEDIATE) {
|
||||||
|
// Immediate error
|
||||||
|
return nseU_safeerror(L, nse_status2str(NSE_STATUS_ERROR));
|
||||||
|
}
|
||||||
return yield(L, nu, "SEND", TO, 0, NULL);
|
return yield(L, nu, "SEND", TO, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user