projects
/
virtual-ldap
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8e42b29
)
unroll multiple e-mail addresses into mail, mail_1, mail_2 ...
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 4 Oct 2016 12:01:54 +0000
(14:01 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 4 Oct 2016 12:01:54 +0000
(14:01 +0200)
bin/ldap-rewrite.pl
patch
|
blob
|
history
diff --git
a/bin/ldap-rewrite.pl
b/bin/ldap-rewrite.pl
index
0a3acfa
..
e9be738
100755
(executable)
--- 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";
}
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] ] };
+ }
}
}
}
}