Re: [Mimedefang] Timeout on md_check_against_smtp_server?

2015-08-17 Thread Dave Osbourne

Dianne,

Thank you very much for this!

Changes effected and tested over the w/end and all seems OK.  I'd never 
thought to do this if it weren't for that little prod.


Regards,
Dave

On 15/08/2015 15:42, Dianne Skoll wrote:

On Sat, 15 Aug 2015 12:39:04 +0100
Dave Osbourne d...@osbourne.uk.eu.org wrote:


I wonder if there is away to enforce a timeout on
md_check_against_smtp_server?

The general-purpose way of enforcing timeouts is with alarm.

{
 local $SIG{ALRM} = sub { die Timeout; };
 my @result;
 eval {
 alarm(60); # Or whatever timeout you want
 @result = md_check_against_smtp_server(...);
 alarm(0);
 };
 if ($@  $@ =~ /Timeout/) {
 # Handle timeout
 } else {
 # Handle @result
 }
}

Regards,

Dianne.
___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


[Mimedefang] Timeout on md_check_against_smtp_server?

2015-08-15 Thread Dave Osbourne

Hi Everyone,

I wonder if there is away to enforce a timeout on 
md_check_against_smtp_server?


We have 1 client that seems to have a dodgy AD binding that means every 
few months the callout gets stuck indefinitley waiting for the response 
to the RCPT TO: test and eventually all the MD slaves are used, 
effectively DOSing ourselves.


The call never returns... hoping someone else knows a way to enforce a 
timeout perhaps?  or something better even?


Regards
Dave



___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] Timeout on md_check_against_smtp_server?

2015-08-15 Thread Dianne Skoll
On Sat, 15 Aug 2015 12:39:04 +0100
Dave Osbourne d...@osbourne.uk.eu.org wrote:

 I wonder if there is away to enforce a timeout on 
 md_check_against_smtp_server?

The general-purpose way of enforcing timeouts is with alarm.

{
local $SIG{ALRM} = sub { die Timeout; };
my @result;
eval {
 alarm(60); # Or whatever timeout you want
 @result = md_check_against_smtp_server(...);
 alarm(0);
};
if ($@  $@ =~ /Timeout/) {
# Handle timeout
} else {
# Handle @result
}
}

Regards,

Dianne.
___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang