diff --git a/qpsmtpd b/qpsmtpd index a58ce19..891e4c2 100755 --- a/qpsmtpd +++ b/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 () { 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"