only send messages smaller than 500000 bytes to spamd
git-svn-id: https://svn.perl.org/qpsmtpd/branches/v010@42 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
245bdd1acf
commit
2ee95fc3fc
@ -1 +1,2 @@
|
|||||||
supervise
|
supervise
|
||||||
|
tmp
|
||||||
|
@ -65,7 +65,6 @@ sub add_header_line {
|
|||||||
sub body_write {
|
sub body_write {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $data = shift;
|
my $data = shift;
|
||||||
#$self->{_body} .= shift;
|
|
||||||
unless ($self->{_body_file}) {
|
unless ($self->{_body_file}) {
|
||||||
-d "tmp" or mkdir("tmp", 0700) or die "Could not create dir tmp: $!";
|
-d "tmp" or mkdir("tmp", 0700) or die "Could not create dir tmp: $!";
|
||||||
$self->{_filename} = "/home/smtpd/qpsmtpd/tmp/" . join(":", time, $$, $transaction_counter++);
|
$self->{_filename} = "/home/smtpd/qpsmtpd/tmp/" . join(":", time, $$, $transaction_counter++);
|
||||||
@ -76,7 +75,12 @@ sub body_write {
|
|||||||
seek($self->{_body_file},0,2)
|
seek($self->{_body_file},0,2)
|
||||||
unless $self->{_body_file_writing};
|
unless $self->{_body_file_writing};
|
||||||
$self->{_body_file_writing} = 1;
|
$self->{_body_file_writing} = 1;
|
||||||
$self->{_body_file}->print(ref $data eq "SCALAR" ? $$data : $data);
|
$self->{_body_file}->print(ref $data eq "SCALAR" ? $$data : $data)
|
||||||
|
and $self->{_body_size} += length (ref $data eq "SCALAR" ? $$data : $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub body_size {
|
||||||
|
shift->{_body_size} || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub body_resetpos {
|
sub body_resetpos {
|
||||||
|
@ -1 +1,2 @@
|
|||||||
|
main
|
||||||
supervise
|
supervise
|
||||||
|
@ -23,6 +23,8 @@ sub register {
|
|||||||
sub check_spam {
|
sub check_spam {
|
||||||
my ($self, $transaction) = @_;
|
my ($self, $transaction) = @_;
|
||||||
|
|
||||||
|
return (DECLINED) if $transaction->body_size > 500_000;
|
||||||
|
|
||||||
my $remote = 'localhost';
|
my $remote = 'localhost';
|
||||||
my $port = 783;
|
my $port = 783;
|
||||||
if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') }
|
if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') }
|
||||||
|
Loading…
Reference in New Issue
Block a user