This file is indexed.

/usr/share/qpsmtpd/plugins/check_badmailfromto is in qpsmtpd 0.84-11.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#! perl

=head1 NAME

check_badmailfromto - checks the badmailfromto config

=head1 DESCRIPTION

Much like the similar check_badmailfrom, this plugin references both the
FROM: and TO: lines, and if they both are present in the badmailfromto
config file (a tab delimited list of FROM/TO pairs), then the message is
blocked as if the recipient (TO) didn't exist.  This is specifically designed
to not give the impression that the sender is blocked (good for cases of
harassment).

Based heavily on check_badmailfrom.

=cut

sub hook_mail {
  my ($self, $transaction, $sender, %param) = @_;

  my @badmailfromto = $self->qp->config("badmailfromto")
    or return (DECLINED);

  return (DECLINED) unless ($sender->format ne "<>"
			    and $sender->host && $sender->user);

  my $host = lc $sender->host;
  my $from = lc($sender->user) . '@' . $host;

  for my $bad (@badmailfromto) {
    $bad =~ s/^\s*(\S+).*/$1/;
    next unless $bad;
    $bad = lc $bad;
    $self->log(LOGWARN, "Bad badmailfromto config: No \@ sign in $bad") and next unless $bad =~ m/\@/;
    $transaction->notes('badmailfromto', "$bad")
      if ($bad eq $from)
      || (substr($bad,0,1) eq '@' && $bad eq "\@$host");
  }
  return (DECLINED);
}

sub hook_rcpt {
  my ($self, $transaction, $rcpt, %param) = @_;
  my $recipient = lc($rcpt->user) . '@' . lc($rcpt->host);
  my $sender = $transaction->notes('badmailfromto');
  if ($sender) {
    my @badmailfromto = $self->qp->config("badmailfromto")
      or return (DECLINED);

    foreach (@badmailfromto) {
      my ($from, $to) = m/^\s*(\S+)\t(\S+).*/;
      return (DENY, "mail to $recipient not accepted here")
        if lc($from) eq $sender and lc($to) eq $recipient;
    }
  }
  return (DECLINED);
}