split homePostalAddress master
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 25 Jan 2021 12:52:57 +0000 (13:52 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 25 Jan 2021 12:52:57 +0000 (13:52 +0100)
bin/ldap-rewrite.pl

index e9be738..b6f726f 100755 (executable)
@@ -157,6 +157,14 @@ sub log_response {
                                foreach my $i ( 0 .. $#{ $attr->{vals} } ) {
                                        $attr->{vals}->[$i] =~ s/^u2010/p2010/gs && warn "FIXME group";
                                }
+                       } elsif ( $attr->{type} eq 'homePostalAddress' ) {
+                               foreach my $val ( @{ $attr->{vals} } ) {
+                                       next if $val !~ m{^(.+)\s*,\s*(\d+)\s+(.+)};
+                                       push @attrs,
+                                               { type => 'homePostalAddress_address', vals => [ $1 ] },
+                                               { type => 'homePostalAddress_zipcode', vals => [ $2 ] },
+                                               { type => 'homePostalAddress_city', vals => [ $3 ] };
+                               }
                        } elsif ( $attr->{type} eq 'mail' ) {
                                my @emails;
                                foreach my $i ( 0 .. $#{ $attr->{vals} } ) {