1 |
stephdl |
1.1 |
diff -Nur -x '*.orig' -x '*.rej' qpsmtpd-plugins-openfusion-20050429/plugins/check_goodrcptto mezzanine_patched_qpsmtpd-plugins-openfusion-20050429/plugins/check_goodrcptto |
2 |
|
|
--- qpsmtpd-plugins-openfusion-20050429/plugins/check_goodrcptto 2005-04-29 10:11:37.000000000 +1000 |
3 |
|
|
+++ mezzanine_patched_qpsmtpd-plugins-openfusion-20050429/plugins/check_goodrcptto 2006-08-18 17:33:46.595771275 +1000 |
4 |
|
|
@@ -52,28 +52,34 @@ |
5 |
|
|
my $host = lc $recipient->host; |
6 |
|
|
my $user = lc $recipient->user; |
7 |
|
|
return (DECLINED) unless $host && $user; |
8 |
|
|
- my $address = $user; |
9 |
|
|
- $address .= '@' . $host if $host; |
10 |
|
|
- # Setup another user and address stripped of extensions |
11 |
|
|
- my ($user2, $address2); |
12 |
|
|
+ # Setup users and address stripped of extensions |
13 |
|
|
+ my (@parts, @users, @addresses); |
14 |
|
|
my $extn = $self->{_extn}; |
15 |
|
|
- if ($extn && $user =~ m/^([^$extn]+)$extn/) { |
16 |
|
|
- $user2 = $1; |
17 |
|
|
- $address2 = $user2; |
18 |
|
|
- $address2 .= '@' . $host if $host; |
19 |
|
|
- $self->log(LOGDEBUG, "address includes extn '$extn', checking both $user and $user2"); |
20 |
|
|
+ if ($extn) { |
21 |
|
|
+ @parts = split /$extn/, $user; |
22 |
|
|
+ foreach (0..$#parts) { |
23 |
|
|
+ push @users, join $extn, @parts[0..$_]; |
24 |
|
|
+ } |
25 |
|
|
+ $self->log(LOGDEBUG, "address includes extn '$extn', checking users: " . (join ' ', @users)); |
26 |
|
|
+ } else { |
27 |
|
|
+ push @users, $user; |
28 |
|
|
} |
29 |
|
|
+ @addresses = map { $_ . "@" . $host } @users; |
30 |
|
|
for my $good (@goodrcptto) { |
31 |
|
|
$good =~ s/^\s*(\S+).*/\L$1/; |
32 |
|
|
- return (DECLINED) if $good eq $address; |
33 |
|
|
- return (DECLINED) if $address2 && $good eq $address2; |
34 |
|
|
+ foreach (@addresses) { |
35 |
|
|
+ return (DECLINED) if $good eq $_; |
36 |
|
|
+ } |
37 |
|
|
# Allow wildcard '@domain.com' entries |
38 |
|
|
return (DECLINED) if substr($good,0,1) eq '@' && $good eq "\@$host"; |
39 |
|
|
# Allow wildcard bare 'username' entries e.g. 'postmaster' |
40 |
|
|
- return (DECLINED) if index($good,'@') < 0 && $good eq $user; |
41 |
|
|
- return (DECLINED) if $user2 && index($good,'@') < 0 && $good eq $user2; |
42 |
|
|
+ if (index($good,'@') < 0) { |
43 |
|
|
+ foreach (@users) { |
44 |
|
|
+ return (DECLINED) if $good eq $_; |
45 |
|
|
+ } |
46 |
|
|
+ } |
47 |
|
|
} |
48 |
|
|
- $self->log(LOGWARN, "recipient $address denied"); |
49 |
|
|
+ $self->log(LOGWARN, "recipient $addresses[$#addresses] denied"); |
50 |
|
|
# Set/increment the specified deny_note, if applicable |
51 |
|
|
if ($self->{_deny_note}) { |
52 |
|
|
my ($name, $value) = ($self->{_deny_note} =~ m/^([-\w]+)(?:=([\d.]+))?/); |
53 |
|
|
@@ -82,7 +88,7 @@ |
54 |
|
|
if $name; |
55 |
|
|
$self->log(LOGDEBUG, "deny_note: $name=" . $self->qp->connection->notes($name)); |
56 |
|
|
} |
57 |
|
|
- return (DENY, "invalid recipient $address"); |
58 |
|
|
+ return (DENY, "invalid recipient $addresses[$#addresses]"); |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
# arch-tag: 2d2195a5-27b0-465d-a68f-f425efae2cc0 |