Paul Johnston <[EMAIL PROTECTED]> writes:

> The problem with this type of plugin is that
> the connect might fail for some legitimate reason, e.g. the server
> limits connections per second per IP address.

Or worse, disable the SMTP listener is the system load is too high
(sendmail does this)

Maybe we should replace the "alive test" in all scripts by something
like this. If the service is still alive, this code will not slow down
the tests. If it is dead, it will wait a little longer, but that's the
price to avoid false alarms on network glitches.

Ideally, when the network is temporaly down, we should suspend the
tests until it goes up again. SOmething to do here?

 --------

function open_sock_retry(port, count)
{
  local_var     i, s;
  for (i = 0; i < count; i++)
  {
    s = open_sock_tcp(port: port);      # timeout?
    if (s) return s;
    sleep(1);   # In case we got a "connection refused"?
  }
  return;       # NULL
}

 ---------

soc = open_sock_retry(port: port, count: 3);
if (soc)
  r = smtp_recv_banner(socket:soc);
else
 r = NULL;

if (!r) security_hole(port);

Reply via email to