mirror of
https://github.com/nmap/nmap.git
synced 2025-12-15 12:19:02 +00:00
Added a new NSE_STATUS_PROXYERROR status type to report proxy-related errors
back to caller.
This commit is contained in:
@@ -322,8 +322,9 @@ enum nse_status {
|
||||
nspool is being deleted -- you should free up any
|
||||
resources you have allocated and exit. Don't you
|
||||
dare make any more async nsock calls! */
|
||||
NSE_STATUS_EOF /* We got EOF and NO DATA -- if we got data first,
|
||||
NSE_STATUS_EOF, /* We got EOF and NO DATA -- if we got data first,
|
||||
SUCCESS is reported (see nse_eof()). */
|
||||
NSE_STATUS_PROXYERROR
|
||||
};
|
||||
|
||||
enum nse_status nse_status(nsock_event nse);
|
||||
|
||||
@@ -500,6 +500,7 @@ const char *nse_status2str(enum nse_status status) {
|
||||
case NSE_STATUS_CANCELLED: return "CANCELLED";
|
||||
case NSE_STATUS_KILL: return "KILL";
|
||||
case NSE_STATUS_EOF: return "EOF";
|
||||
case NSE_STATUS_PROXYERROR: return "PROXY ERROR";
|
||||
default:
|
||||
return "UNKNOWN!";
|
||||
}
|
||||
|
||||
@@ -433,11 +433,13 @@ void forward_event(nsock_pool nspool, nsock_event nsevent, void *udata) {
|
||||
cached_status = nse->status;
|
||||
|
||||
nse->type = NSE_TYPE_CONNECT;
|
||||
nse->status = NSE_STATUS_SUCCESS;
|
||||
|
||||
if (nse->status != NSE_STATUS_SUCCESS)
|
||||
nse->status = NSE_STATUS_PROXYERROR;
|
||||
|
||||
if (nsp->tracelevel > 0)
|
||||
nsock_trace(nsp, "Forwarding event upstream: SUCCESS TCP connect (IOD #%li) EID %li",
|
||||
nse->iod->id, nse->id);
|
||||
nsock_trace(nsp, "Forwarding event upstream: TCP connect %s (IOD #%li) EID %li",
|
||||
nse_status2str(nse->status), nse->iod->id, nse->id);
|
||||
|
||||
nse->iod->px_ctx->target_handler(nsp, nse, udata);
|
||||
|
||||
@@ -447,13 +449,15 @@ void forward_event(nsock_pool nspool, nsock_event nsevent, void *udata) {
|
||||
|
||||
void nsock_proxy_ev_dispatch(nsock_pool nspool, nsock_event nsevent, void *udata) {
|
||||
msevent *nse = (msevent *)nsevent;
|
||||
struct proxy_node *current;
|
||||
|
||||
if (nse->status != NSE_STATUS_SUCCESS)
|
||||
fatal("Error, but this is debug only!");
|
||||
if (nse->status == NSE_STATUS_SUCCESS) {
|
||||
struct proxy_node *current;
|
||||
|
||||
current = proxy_ctx_node_current(nse->iod->px_ctx);
|
||||
assert(current);
|
||||
current->ops->handler(nspool, nsevent, udata);
|
||||
} else {
|
||||
forward_event(nspool, nsevent, udata);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user