--- amavisd~ Tue Nov 19 20:52:54 2002 +++ amavisd Tue Nov 19 20:54:04 2002 @@ -2440,7 +2440,7 @@ my($logmsg) = sprintf("%s via SMTP: [%s:%s] <%s>", ($initial_submission ? 'SEND' : 'FWD'), $relayhost, $relayhost_port, $msginfo->sender); - if (!@per_recip_data) { do_log(5, "$logmsg, no recipients"); return 1 } + if (!@per_recip_data) { do_log(5, "$logmsg, nothing to do"); return 1 } do_log(1, $logmsg . " -> " . join(",", map {"<".$_->recip_final_addr.">"} @per_recip_data)); my($msg) = $msginfo->mail_text; # a scalar reference, or a file handle @@ -2632,7 +2632,7 @@ @{$msginfo->per_recip_data}; my($logmsg) = sprintf("%s via PIPE: <%s>", ($initial_submission ? 'SEND' : 'FWD'), $msginfo->sender); - if (!@per_recip_data) { do_log(5,"$logmsg, no recipients"); return 1 } + if (!@per_recip_data) { do_log(5,"$logmsg, nothing to do"); return 1 } do_log(1, $logmsg . " -> " . join(",", map {"<".$_->recip_final_addr.">"} @per_recip_data)); my($msg) = $msginfo->mail_text; # a scalar reference, or a file handle @@ -2647,10 +2647,11 @@ my(@command) = shift @pipe_args; for (@pipe_args) { if (/^\${sender}$/i) { - push(@command, quote_rfc2821_local($msginfo->sender)); + push(@command, map { $_ eq '' ? '' : quote_rfc2821_local($_) } + $msginfo->sender); } elsif (/^\${recipient}$/i) { - push(@command, map { quote_rfc2821_local($_->recip_final_addr) } - @per_recip_data); + push(@command, map { $_ eq '' ? '' : quote_rfc2821_local($_) } + map { $_->recip_final_addr } @per_recip_data); } else { push(@command, $_) } } do_log(5,"mail_via_pipe running command: ".join(' ',@command)); @@ -4690,8 +4691,8 @@ # generate customized log report - this is usually the only log entry # interesting to administrators during normal operation - my($strr) = expand(\$log_templ,\%builtins); chomp($$strr); - do_log(0, $$strr) if $$strr !~ /^\s*$/; + my($strr) = expand(\$log_templ,\%builtins); $$strr =~ s/[\s\n\r]+$//; + do_log(0, $$strr) if $$strr ne ''; }; # end eval if ($@ ne '') { @@ -4864,13 +4865,12 @@ } if (!$warnvirusrecip) { - # warn_recip() is disabled by default because of possible problems - # with mailing lists. Enable only if you know what you're doing! + # warn_recip() normally disabled - it is usually counterproductive + # Enable only if you know what you are doing! } else { - my(@locals) = grep { ! $_->recip_done && - ($warn_offsite || lookup($_->recip_addr, - \@local_domains, $local_domains_re)) - } @{$msginfo->per_recip_data}; + my(@locals) = grep { $warn_offsite || + lookup($_, \@local_domains, $local_domains_re) + } @{$msginfo->recips}; if (@locals) { my($notification) = Amavis::In::Message->new; $notification->sender($mailfrom_notify_recip); @@ -5202,6 +5202,11 @@ Amavis::Log::init("amavis", !$daemonize, $DO_SYSLOG, $SYSLOG_LEVEL, $LOGFILE, $log_level); +if ($forward_method eq '' && $extra_code_in_smtp) { + do_log(1, "forward_method is null (probably milter setup), ". + "DISABLING SMTP-in AS A PRECAUTION"); + $extra_code_in_smtp = undef; +} do_log(1, "Found myself: $amavisd_path -c $config_file"); do_log(1, "AMCL-in protocol code ".($extra_code_in_amcl?'':" NOT")." loaded"); do_log(1, "SMTP-in protocol code ".($extra_code_in_smtp?'':" NOT")." loaded"); @@ -5489,7 +5494,7 @@ use Time::HiRes qw(time); BEGIN { - import Amavis::Conf qw($TEMPBASE $myhostname + import Amavis::Conf qw($TEMPBASE $myhostname $forward_method $child_timeout $can_truncate @debug_sender_acl); import Amavis::Util qw(do_log am_id prolong_timer debug_oneshot sanitize_str strip_tempdir rmdir_recursively); @@ -5820,6 +5825,11 @@ &$check_mail($conn,$msginfo, $lmtp,$self->{tempdir_pers}); if ($preserve_evidence) { $self->preserve_evidence(1) } + if ($smtp_resp !~ /^4/ && + grep { !$_->recip_done } @{$msginfo->per_recip_data}) { + die "TROUBLE/MISCONFIG: not all recipients done, ". + "\$forward_method is \"$forward_method\""; + } if (!$lmtp) { do_log(4, "sending SMTP response: \"$smtp_resp\""); $self->smtp_resp(0, $smtp_resp);