Hanno Hecker wrote:
On Wed, 28 Feb 2007 20:52:21 +0100
Hans Salvisberg <[EMAIL PROTECTED]> wrote:
Is there a hook that is always fired at the end of a connection under
xinetd?
If qpsmtpd disconnects, then hook_disconnect() and
hook_post_connection() are fired. But if the other side disconnects
without a QUIT, then neither of them are fired.
>
Does the attached diff work? It should fire the post-connection hook on
disconnect w/o QUIT.
Hanno
------------------------------------------------------------------------
--- qpsmtpd.orig 2007-03-01 18:15:39.000000000 +0100
+++ qpsmtpd 2007-03-01 18:16:32.000000000 +0100
@@ -22,6 +22,7 @@
$qpsmtpd->load_plugins();
$qpsmtpd->start_connection();
$qpsmtpd->run();
+$qpsmtpd->run_hooks("post-connection");
__END__
Yes, this is much better:
1. I was expecting hook_post_connection() to be fired twice in some
cases now, but this isn't happening. Apparently run_hooks() is smart
enough to not fire "post-connection" twice.
2. I run check_earlytalker with "action denysoft defer-reject 1", and
the INFO log shows only
Connection from WHATEVER [123.123.123.123]
remote host started talking before we said hello [123.123.123.123]
220 example.com ESMTP
It doesn't show the returned error code/message, hook_deny() is not
fired (or maybe absorbed by some other plugin?), and
hook_post_connection() wasn't called either. I looked at the code of
check_earlytalker, but I can't find out why it behaves this way. Anyway,
with this patch, at least hook_post_connection() is fired.
3. With the patch, about 99% of the connections get a
hook_post_connection() call, which is way up from about 50%! Among the
remaining 1% I've seen some abandoned
-- after a few successful RCPTs (doomed by check_verybadrcptto
deny_late but still underway),
-- during DATA, or
-- after 500 Unrecognized command
I don't see, what they might have in common. Maybe they're abandoned
connections that time out and are killed by xinetd? -- It turns out that
some are still hanging (see my next post), but I don't know what the
fate of the others was.
Hans