test sircam block. (should be moved to external "filter")
fix bug with malformed rcpt to: commands. git-svn-id: https://svn.perl.org/qpsmtpd/trunk@3 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
615c00ea97
commit
0664a76dc3
9
qpsmtpd
9
qpsmtpd
@ -146,6 +146,7 @@ sub rcpt {
|
||||
return respond(501, "syntax error in parameters") unless $_[0] =~ m/^to:/i;
|
||||
return(503, "Use MAIL before RCPT") unless $state{transaction}->{from};
|
||||
my ($rcpt) = ($_[0] =~ m/to:(.*)/i)[0];
|
||||
$rcpt = $_[1] unless $rcpt;
|
||||
$rcpt = (Mail::Address->parse($rcpt))[0];
|
||||
return respond(501, "could not parse recipient") unless $rcpt;
|
||||
return respond(550, "will not relay for ". $rcpt->host) unless check_relay($rcpt->host);
|
||||
@ -161,6 +162,8 @@ sub data {
|
||||
my $size = 0;
|
||||
my $i = 0;
|
||||
my $max_size = get_config('databytes') || 0;
|
||||
my $blocked = "";
|
||||
my $header = 1;
|
||||
while (<STDIN>) {
|
||||
last if $_ eq ".\r\n";
|
||||
$i++;
|
||||
@ -168,6 +171,11 @@ sub data {
|
||||
if $_ eq ".\n";
|
||||
unless ($max_size and $size > $max_size) {
|
||||
s/\r\n$/\n/;
|
||||
$header = 0 if $header and m/^\s*$/;
|
||||
$blocked = "Your mail looks too much like that SirCam nonsense, please go away"
|
||||
if $header
|
||||
and $state{transaction}->{from}->format eq "<>"
|
||||
and $_ eq "Content-Disposition: Multipart message";
|
||||
$buffer .= $_;
|
||||
$size += length $_;
|
||||
}
|
||||
@ -176,6 +184,7 @@ sub data {
|
||||
alarm $config{timeout};
|
||||
}
|
||||
|
||||
respond(550, $blocked),return 1 if $blocked;
|
||||
respond(552, "Message too big!"),return 1 if $max_size and $size > $max_size;
|
||||
|
||||
# these bits inspired by Peter Samuels "qmail-queue wrapper"
|
||||
|
Loading…
Reference in New Issue
Block a user