Added handling of the new NSE_STATUS_PROXYERROR case.

This commit is contained in:
henri 2013-04-22 19:32:36 +00:00
parent c9d237f26b
commit 99258673ad
3 changed files with 26 additions and 17 deletions

View file

@ -441,7 +441,7 @@ void FPNetworkControl::probe_transmission_handler(nsock_pool nsp, nsock_event ns
} else if (status == NSE_STATUS_EOF) {
if (o.debugging)
log_write(LOG_PLAIN, "probe_transmission_handler(): EOF\n");
} else if (status == NSE_STATUS_ERROR) {
} else if (status == NSE_STATUS_ERROR || status == NSE_STATUS_PROXYERROR) {
if (o.debugging)
log_write(LOG_PLAIN, "probe_transmission_handler(): %s failed: %s\n", nse_type2str(type), strerror(socket_errno()));
} else if (status == NSE_STATUS_TIMEOUT) {
@ -566,7 +566,7 @@ void FPNetworkControl::response_reception_handler(nsock_pool nsp, nsock_event ns
} else if (status == NSE_STATUS_EOF) {
if (o.debugging)
log_write(LOG_PLAIN, "response_reception_handler(): EOF\n");
} else if (status == NSE_STATUS_ERROR) {
} else if (status == NSE_STATUS_ERROR || NSE_STATUS_PROXYERROR) {
if (o.debugging)
log_write(LOG_PLAIN, "response_reception_handler(): %s failed: %s\n", nse_type2str(type), strerror(socket_errno()));
} else if (status == NSE_STATUS_TIMEOUT) {

View file

@ -331,6 +331,7 @@ static void status (lua_State *L, enum nse_status status)
case NSE_STATUS_EOF:
case NSE_STATUS_ERROR:
case NSE_STATUS_TIMEOUT:
case NSE_STATUS_PROXYERROR:
lua_pushnil(L);
lua_pushstring(L, nse_status2str(status));
nse_restore(L, 2);

View file

@ -2253,23 +2253,31 @@ static void servicescan_connect_handler(nsock_pool nsp, nsock_event nse, void *m
send_probe_text(nsp, nsi, svc, probe);
// Now let us read any results
nsock_read(nsp, nsi, servicescan_read_handler, svc->probe_timemsleft(probe, nsock_gettimeofday()), svc);
} else if (status == NSE_STATUS_TIMEOUT || status == NSE_STATUS_ERROR) {
// This is not good. The connect() really shouldn't generally
// be timing out like that. We'll mark this svc as incomplete
// and move it to the finished bin.
if (o.debugging)
error("Got nsock CONNECT response with status %s - aborting this service", nse_status2str(status));
end_svcprobe(nsp, PROBESTATE_INCOMPLETE, SG, svc, nsi);
} else if (status == NSE_STATUS_KILL) {
/* User probablby specified host_timeout and so the service scan is
shutting down */
end_svcprobe(nsp, PROBESTATE_INCOMPLETE, SG, svc, nsi);
return;
} else fatal("Unexpected nsock status (%d) returned for connection attempt", (int) status);
} else {
switch(status) {
case NSE_STATUS_TIMEOUT:
case NSE_STATUS_ERROR:
case NSE_STATUS_PROXYERROR:
// This is not good. The connect() really shouldn't generally
// be timing out like that. We'll mark this svc as incomplete
// and move it to the finished bin.
if (o.debugging)
error("Got nsock CONNECT response with status %s - aborting this service", nse_status2str(status));
end_svcprobe(nsp, PROBESTATE_INCOMPLETE, SG, svc, nsi);
break;
case NSE_STATUS_KILL:
/* User probablby specified host_timeout and so the service scan is
* shutting down */
end_svcprobe(nsp, PROBESTATE_INCOMPLETE, SG, svc, nsi);
return;
default:
fatal("Unexpected nsock status (%d) returned for connection attempt", (int)status);
}
}
// We may have room for more pr0bes!
launchSomeServiceProbes(nsp, SG);
return;
}
@ -2306,7 +2314,7 @@ static void servicescan_write_handler(nsock_pool nsp, nsock_event nse, void *myd
return;
}
if (status == NSE_STATUS_ERROR) {
if (status == NSE_STATUS_ERROR || status == NSE_STATUS_PROXYERROR) {
err = nse_errorcode(nse);
error("Got nsock WRITE error #%d (%s)", err, strerror(err));
}