I applied this to my tree, but then reverted it.  

It may be possible for the _body_file fh to be closed, but _filename
still be set.

Do we still want to fail in that case?

-R


Steve Kemp wrote:
> 
>   The current code in body_filename doesn't test that
>  the flush operation succeeds leading to potential
>  message loss.
> 
>   All current plugins distributed in the core test
>  to see if body_filename() returns a defined value
>  so we can fix this with the following patch:
> 
> --
> s...@gold:~/git/qpsmtpd$ git diff
> diff --git a/lib/Qpsmtpd/Transaction.pm b/lib/Qpsmtpd/Transaction.pm
> index 18635ad..765ed1b 100644
> --- a/lib/Qpsmtpd/Transaction.pm
> +++ b/lib/Qpsmtpd/Transaction.pm
> @@ -101,8 +101,12 @@ sub body_current_pos {
>  sub body_filename {
>    my $self = shift;
>    $self->body_spool() unless $self->{_filename};
> -  $self->{_body_file}->flush(); # so contents won't be cached
> -  return $self->{_filename};
> +
> +  # ensure contents won't be cached
> +  if ( $self->{_body_file}->flush() ) {
> +    return $self->{_filename};
> +  }
> +  return undef;
>  }
> 
>  sub body_spool {
> --
> 
> Steve
> --
> Debian GNU/Linux System Administration
> http://www.debian-administration.org/
> 

Reply via email to