summaryrefslogtreecommitdiffstats
path: root/roles/MX/files/usr
diff options
context:
space:
mode:
Diffstat (limited to 'roles/MX/files/usr')
-rwxr-xr-xroles/MX/files/usr/local/sbin/reserved-alias.pl6
1 files changed, 3 insertions, 3 deletions
diff --git a/roles/MX/files/usr/local/sbin/reserved-alias.pl b/roles/MX/files/usr/local/sbin/reserved-alias.pl
index 517e51b..2e61ef6 100755
--- a/roles/MX/files/usr/local/sbin/reserved-alias.pl
+++ b/roles/MX/files/usr/local/sbin/reserved-alias.pl
@@ -44,42 +44,42 @@ my $orig = shift;
$orig =~ /^(.+)\@([^@]+)$/
or warn "Warning: Non fully qualified: $orig";
my ($local,$domain) = ($1,$2);
# The new recipient (typically, the admin site)
my @recipients = grep { $_ and $orig ne $_ }
# add localparts to domain
map { my $x = $_;
if ($x =~ /^\@/) {
$x = (defined $local and $local ne '') ? $local.$x : undef;
}
$x
}
@ARGV;
# Die if we can't deliver to site admins
die "Error: Aborted delivery to '$orig' in attempt to break an alias expansion loop.\n"
unless @recipients;
if (defined $domain) {
# Look for the domain owner or postmaster
- my $ldap = Net::LDAPI->new();
- $ldap->bind( sasl => Authen::SASL->new(mechanism => 'EXTERNAL') )
+ my $ldap = Net::LDAPI::->new();
+ $ldap->bind( undef, sasl => Authen::SASL::->new(mechanism => 'EXTERNAL') )
or die "Error: Couldn't bind";
my @attrs = ( 'fripostPostmaster', 'fripostOwner' );
my $mesg = $ldap->search( base => 'fvd='.escape_dn_value($domain).','
.'ou=virtual,dc=fripost,dc=org'
, scope => 'base'
, deref => 'never'
, filter => '(&(objectClass=FripostVirtualDomain)'
.'(fvd='.escape_filter_value($domain).')'.
')'
, attrs => \@attrs
);
if ($mesg->code) {
warn "Warning: ".$mesg->error;
}
elsif ($mesg->count != 1) {
# Note: this may happen for "$mydestination", but these mails
# are unlikely. We'll get a harmless warning at worst.
warn "Warning: Something weird happened when looking up domain '".$domain.
"'. Check your ACL.";
@@ -87,25 +87,25 @@ if (defined $domain) {
else {
my $entry = $mesg->pop_entry() // die "Error: Cannot pop entry.";
foreach (@attrs) {
my $v = $entry->get_value($_, asref => 1) or next;
foreach my $dn (@$v) {
my $dn2 = ldap_explode_dn($dn, casefold => 'lower');
my $l = $dn2->[0]->{fvl};
my $d = $dn2->[1]->{fvd};
if ($l ne '' and $d ne '') {
push @recipients, $l.'@'.$d;
}
else {
warn "Warning: Invalid DN: $dn"
}
}
}
}
$ldap->unbind;
}
-my $smtp = Net::SMTP->new( 'localhost:25', Timeout => 1200 );
+my $smtp = Net::SMTP::->new( 'localhost:25', Timeout => 1200 );
$smtp->mail($sender);
$smtp->to(@recipients, { Notify => ['FAILURE','DELAY'], SkipBad => 1 });
$smtp->data(<STDIN>);
$smtp->quit;