From f6f14a81c599eb32bc75d2790b04bbe44b1a98b9 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 17 Jul 2019 12:39:31 +0200 Subject: [PATCH] Dedup LDAP aliases in zimbraNotes --- zmldapsync/zmldapsync.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zmldapsync/zmldapsync.pl b/zmldapsync/zmldapsync.pl index 6169d6a..4a33680 100644 --- a/zmldapsync/zmldapsync.pl +++ b/zmldapsync/zmldapsync.pl @@ -9,6 +9,7 @@ use Getopt::Long; use Data::UUID; use String::ShellQuote qw(shell_quote); use Array::Diff; +use List::MoreUtils qw(uniq); use Hash::Merge::Simple qw(merge); use Text::Unidecode; use Email::MIME; @@ -388,7 +389,7 @@ DOMAIN: foreach my $domain ( keys $conf->{domains} ) { @{ $ext_users->{$user}->{$conf->{domains}->{$domain}->{users}->{$mail_attr}} }; } - @ext_aliases = sort @ext_aliases; + @ext_aliases = sort uniq @ext_aliases; foreach my $alias ( @ext_aliases ) { next if ( not alias_matches_domain( $alias, $domain_entry ) ); @@ -630,6 +631,7 @@ DOMAIN: foreach my $domain ( keys $conf->{domains} ) { push @ext_aliases, @{ $ext_groups->{$group}->{$conf->{domains}->{$domain}->{groups}->{$mail_attr}} }; } + @ext_aliases = sort uniq @ext_aliases; foreach my $alias ( @ext_aliases ) { next if ( not alias_matches_domain( $alias, $domain_entry ) ); next if ( grep { $alias eq $_ } @{ $zim_dl->{$group}->{mail} } );