From 0e638f45379d5980a009a4daa6903e1b40eda2b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ask=20Bj=C3=B8rn=20Hansen?= Date: Tue, 6 Aug 2002 13:39:44 +0000 Subject: [PATCH] header bugfixes git-svn-id: https://svn.perl.org/qpsmtpd/branches/v010@45 958fd67b-6ff1-0310-b445-bb7760255be9 --- lib/Qpsmtpd.pm | 21 ++++++++++++--------- plugins/spamassassin | 3 +++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/Qpsmtpd.pm b/lib/Qpsmtpd.pm index 618717c..c2629c6 100644 --- a/lib/Qpsmtpd.pm +++ b/lib/Qpsmtpd.pm @@ -334,14 +334,15 @@ sub data { } if ($in_header) { - #. .. + $buffer .= $_; + } + else { + $self->transaction->body_write($_); } - - $self->transaction->body_write($_); $size += length $_; } - $self->log(5, "size is at $size\n") unless ($i % 300); + #$self->log(5, "size is at $size\n") unless ($i % 300); alarm $timeout; } @@ -350,6 +351,12 @@ sub data { $self->transaction->header($header); + $header->add("Received", "from ".$self->connection->remote_info + ." (HELO ".$self->connection->hello_host . ") (".$self->connection->remote_ip + . ") by ".$self->config('me')." (qpsmtpd/".$self->version + .") with SMTP; ". (strftime('%Y-%m-%d %TZ', gmtime)), + 0); + # if we get here without seeing a terminator, the connection is # probably dead. $self->respond(451, "Incomplete DATA"), return 1 unless $complete; @@ -384,11 +391,7 @@ sub queue { close MESSAGE_READER or fault("close msg reader fault"),exit; close ENVELOPE_READER or fault("close envelope reader fault"), exit; - print MESSAGE_WRITER "Received: from ".$self->connection->remote_info - ." (HELO ".$self->connection->hello_host . ") (".$self->connection->remote_ip - . ")\n by ".$self->config('me')." (qpsmtpd/".$self->version - .") with SMTP; ". (strftime('%Y-%m-%d %TZ', gmtime)) . "\n"; - print MESSAGE_WRITER "X-smtpd: qpsmtpd/",$self->version,", http://develooper.com/code/qpsmtpd/\n"; + $transaction->header->add("X-SMTPD", "qpsmtpd/".$self->version.", http://develooper.com/code/qpsmtpd/"); $transaction->header->print(\*MESSAGE_WRITER); $transaction->body_resetpos; diff --git a/plugins/spamassassin b/plugins/spamassassin index 0034f45..3a06348 100644 --- a/plugins/spamassassin +++ b/plugins/spamassassin @@ -43,6 +43,9 @@ sub check_spam { print SPAMD "YAREPORT SPAMC/1.0" . CRLF; # or CHECK or REPORT or SYMBOLS + print SPAMD join CRLF, split /\n/, $transaction->header->as_string; + print SPAMD CRLF; + while (my $line = $transaction->body_getline) { chomp $line; print SPAMD $line, CRLF;