On Sun, 27 Feb 2005 23:17:59 -0800
Ask Bj�rn Hansen <[EMAIL PROTECTED]> wrote:
> On Feb 27, 2005, at 10:53 PM, Hanno Hecker wrote:
>
> > Why you don't write the headers to the temp file when the body
> > starts and modify Qpsmtpd::Transaction::body_resetpos() to seek to
> > the beginning of the body (i.e.
> > length($transaction->header->as_string)+1). Then there's a full mail
> > in the temp file like clamav (and maybe other scanners) want it.
>
> Because you ought to rewrite it when the headers change (or it'd just
> be weird). Right? Or?
Hmm... no, just use everything else as before, feed the headers to the
queue and to other plugins from memory. Just change the position where
the body starts in the temp file.
Hanno
P.S.: example diff attached
--- Transaction.pm.bak Mon Feb 28 09:41:12 2005
+++ Transaction.pm Mon Feb 28 09:50:57 2005
@@ -70,6 +70,9 @@
$self->{_filename} = $self->temp_file();
$self->{_body_file} = IO::File->new($self->{_filename}, O_RDWR|O_CREAT,
0600)
or die "Could not open file $self->{_filename} - $! "; # .
$self->{_body_file}->error;
+ my $headers = $self->header->as_string."\n";
+ $self->{_body_file}->print($headers);
+ $self->{_body_start} = length($headers);
}
# go to the end of the file
seek($self->{_body_file},0,2)
@@ -86,7 +89,8 @@
sub body_resetpos {
my $self = shift;
return unless $self->{_body_file};
- seek($self->{_body_file}, 0,0);
+ my $start = $self->{_body_start} || 0;
+ seek($self->{_body_file}, $start, 0);
$self->{_body_file_writing} = 0;
1;
}
@@ -94,7 +98,8 @@
sub body_getline {
my $self = shift;
return unless $self->{_body_file};
- seek($self->{_body_file}, 0,0)
+ my $start = $self->{_body_start} || 0;
+ seek($self->{_body_file}, $start,0)
if $self->{_body_file_writing};
$self->{_body_file_writing} = 0;
my $line = $self->{_body_file}->getline;