You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qpsmtpd-plugins/check_goodrcptto_hypens.patch

62 lines
2.6 KiB
Diff

diff -Nur -x '*.orig' -x '*.rej' qpsmtpd-plugins-openfusion-20050429/plugins/check_goodrcptto mezzanine_patched_qpsmtpd-plugins-openfusion-20050429/plugins/check_goodrcptto
--- qpsmtpd-plugins-openfusion-20050429/plugins/check_goodrcptto 2005-04-29 10:11:37.000000000 +1000
+++ mezzanine_patched_qpsmtpd-plugins-openfusion-20050429/plugins/check_goodrcptto 2006-08-18 17:33:46.595771275 +1000
@@ -52,28 +52,34 @@
my $host = lc $recipient->host;
my $user = lc $recipient->user;
return (DECLINED) unless $host && $user;
- my $address = $user;
- $address .= '@' . $host if $host;
- # Setup another user and address stripped of extensions
- my ($user2, $address2);
+ # Setup users and address stripped of extensions
+ my (@parts, @users, @addresses);
my $extn = $self->{_extn};
- if ($extn && $user =~ m/^([^$extn]+)$extn/) {
- $user2 = $1;
- $address2 = $user2;
- $address2 .= '@' . $host if $host;
- $self->log(LOGDEBUG, "address includes extn '$extn', checking both $user and $user2");
+ if ($extn) {
+ @parts = split /$extn/, $user;
+ foreach (0..$#parts) {
+ push @users, join $extn, @parts[0..$_];
+ }
+ $self->log(LOGDEBUG, "address includes extn '$extn', checking users: " . (join ' ', @users));
+ } else {
+ push @users, $user;
}
+ @addresses = map { $_ . "@" . $host } @users;
for my $good (@goodrcptto) {
$good =~ s/^\s*(\S+).*/\L$1/;
- return (DECLINED) if $good eq $address;
- return (DECLINED) if $address2 && $good eq $address2;
+ foreach (@addresses) {
+ return (DECLINED) if $good eq $_;
+ }
# Allow wildcard '@domain.com' entries
return (DECLINED) if substr($good,0,1) eq '@' && $good eq "\@$host";
# Allow wildcard bare 'username' entries e.g. 'postmaster'
- return (DECLINED) if index($good,'@') < 0 && $good eq $user;
- return (DECLINED) if $user2 && index($good,'@') < 0 && $good eq $user2;
+ if (index($good,'@') < 0) {
+ foreach (@users) {
+ return (DECLINED) if $good eq $_;
+ }
+ }
}
- $self->log(LOGWARN, "recipient $address denied");
+ $self->log(LOGWARN, "recipient $addresses[$#addresses] denied");
# Set/increment the specified deny_note, if applicable
if ($self->{_deny_note}) {
my ($name, $value) = ($self->{_deny_note} =~ m/^([-\w]+)(?:=([\d.]+))?/);
@@ -82,7 +88,7 @@
if $name;
$self->log(LOGDEBUG, "deny_note: $name=" . $self->qp->connection->notes($name));
}
- return (DENY, "invalid recipient $address");
+ return (DENY, "invalid recipient $addresses[$#addresses]");
}
# arch-tag: 2d2195a5-27b0-465d-a68f-f425efae2cc0