From 84b4dc745efd12a2a5af6604cbcc8b249e34a8d5 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 5 Sep 2019 22:48:25 +0200 Subject: [PATCH] Fix handling main mail attr as a Zimbra alias --- zmldapsync/zmldapsync.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/zmldapsync/zmldapsync.pl b/zmldapsync/zmldapsync.pl index 9df69ff..6252b80 100644 --- a/zmldapsync/zmldapsync.pl +++ b/zmldapsync/zmldapsync.pl @@ -375,8 +375,9 @@ DOMAIN: foreach my $domain ( keys $conf->{domains} ) { foreach my $mail_attr ( qw( mail_attr alias_attr ) ) { next if ( not defined $conf->{domains}->{$domain}->{users}->{$mail_attr} or not defined $ext_users->{$user}->{$conf->{domains}->{$domain}->{users}->{$mail_attr}} ); - push @ext_aliases, - @{ $ext_users->{$user}->{$conf->{domains}->{$domain}->{users}->{$mail_attr}} }; + push @ext_aliases, ref $ext_users->{$user}->{$conf->{domains}->{$domain}->{users}->{$mail_attr}} eq 'ARRAY' ? + @{ $ext_users->{$user}->{$conf->{domains}->{$domain}->{users}->{$mail_attr}} } : + $ext_users->{$user}->{$conf->{domains}->{$domain}->{users}->{$mail_attr}}; } @ext_aliases = uniq( sort @ext_aliases ); @@ -622,8 +623,9 @@ DOMAIN: foreach my $domain ( keys $conf->{domains} ) { foreach my $mail_attr ( qw( mail_attr alias_attr ) ) { next if ( not defined $conf->{domains}->{$domain}->{groups}->{$mail_attr} or not defined $ext_groups->{$group}->{$conf->{domains}->{$domain}->{groups}->{$mail_attr}} ); - push @ext_aliases, - @{ $ext_groups->{$group}->{$conf->{domains}->{$domain}->{groups}->{$mail_attr}} }; + push @ext_aliases, ref $ext_groups->{$group}->{$conf->{domains}->{$domain}->{groups}->{$mail_attr}} eq 'ARRAY' ? + @{ $ext_groups->{$group}->{$conf->{domains}->{$domain}->{groups}->{$mail_attr}} } : + $ext_groups->{$group}->{$conf->{domains}->{$domain}->{groups}->{$mail_attr}}; } @ext_aliases = uniq( sort @ext_aliases ); foreach my $alias ( @ext_aliases ) {