From 8fdaba4d764b9e534a0343746a3e30cf3f68852e Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Mon, 7 Jul 2014 05:29:09 +0200 Subject: Fix a corner case in reserved-alias.pl. 'if $l' is false when $l is 0, while 0@example.org is a perfectly valid address. --- roles/MX/files/usr/local/sbin/reserved-alias.pl | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'roles') diff --git a/roles/MX/files/usr/local/sbin/reserved-alias.pl b/roles/MX/files/usr/local/sbin/reserved-alias.pl index 2c86020..603d773 100755 --- a/roles/MX/files/usr/local/sbin/reserved-alias.pl +++ b/roles/MX/files/usr/local/sbin/reserved-alias.pl @@ -41,7 +41,7 @@ my $sender = shift; # The original recipient my $orig = shift; -$orig =~ /^([^@]+)\@(.+)$/ +$orig =~ /^(.+)\@([^@]+)$/ or warn "Warning: Non fully qualified: $orig"; my ($local,$domain) = ($1,$2); @@ -50,12 +50,7 @@ my @recipients = grep { $_ and $orig ne $_ } # add localparts to domain map { my $x = $_; if ($x =~ /^\@/) { - if ($local) { - $x = $local.$x; - } - else { - undef $x; - } + $x = (defined $local and $local ne '') ? $local.$x : undef; } $x } @@ -97,7 +92,7 @@ if (defined $domain) { my $dn2 = ldap_explode_dn($dn, casefold => 'lower'); my $l = $dn2->[0]->{fvl}; my $d = $dn2->[1]->{fvd}; - if ($l and $d) { + if ($l ne '' and $d ne '') { push @recipients, $l.'@'.$d; } else { -- cgit v1.2.3