X-Git-Url: http://git.rot13.org/?p=virtual-ldap;a=blobdiff_plain;f=bin%2Fldap-rewrite.pl;h=e9be738c22686ce2262dae98019afcbcd48dce8a;hp=0a3acfae12d95f84979ef2d1a36f1ff3d6cd7550;hb=72a182f851703954afd534a9e4623103b8efdab2;hpb=8e42b29bead920dd0e91ca8ecaedd8fd20020646 diff --git a/bin/ldap-rewrite.pl b/bin/ldap-rewrite.pl index 0a3acfa..e9be738 100755 --- a/bin/ldap-rewrite.pl +++ b/bin/ldap-rewrite.pl @@ -157,6 +157,20 @@ sub log_response { foreach my $i ( 0 .. $#{ $attr->{vals} } ) { $attr->{vals}->[$i] =~ s/^u2010/p2010/gs && warn "FIXME group"; } + } elsif ( $attr->{type} eq 'mail' ) { + my @emails; + foreach my $i ( 0 .. $#{ $attr->{vals} } ) { + my $e = $attr->{vals}->[$i]; + if ( $e =~ m/\s+/ ) { + push @emails, split(/\s+/, $e); + } else { + push @emails, $e; + } + } + $attr->{vals} = [ shift @emails ]; + foreach my $i ( 0 .. $#emails ) { + push @attrs, { type => $attr->{type} . '_' . ( $i + 1 ) , vals => [ $emails[$i] ] }; + } } }