/[virtual-ldap]/bin/ldap-rewrite.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /bin/ldap-rewrite.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 84 by dpavlin, Mon Mar 1 18:57:30 2010 UTC revision 99 by dpavlin, Tue Jul 13 14:50:58 2010 UTC
# Line 139  sub log_response { Line 139  sub log_response {
139                  foreach my $attr ( @{ $response->{protocolOp}->{searchResEntry}->{attributes} } ) {                  foreach my $attr ( @{ $response->{protocolOp}->{searchResEntry}->{attributes} } ) {
140                          if ( $attr->{type} =~ m/date/i ) {                          if ( $attr->{type} =~ m/date/i ) {
141                                  foreach my $i ( 0 .. $#{ $attr->{vals} } ) {                                  foreach my $i ( 0 .. $#{ $attr->{vals} } ) {
142                                          $attr->{vals}->[$i] = "$1-$2-$3" if $attr->{vals}->[$i] =~ m/^([12]\d\d\d)([01]\d+)([123]\d+)$/;                                          $attr->{vals}->[$i] = "$1-$2-$3" if $attr->{vals}->[$i] =~ m/^([12]\d\d\d)([01]\d+)([0123]\d+)$/;
143                                  }                                  }
144                          } elsif ( $attr->{type} eq 'hrEduPersonUniqueNumber' ) {                          } elsif ( $attr->{type} eq 'hrEduPersonUniqueNumber' ) {
145                                  foreach my $val ( @{ $attr->{vals} } ) {                                  foreach my $val ( @{ $attr->{vals} } ) {
146                                          next if $val !~ m{.+:.+};                                          next if $val !~ m{.+:.+};
147                                          my ( $n, $v ) = split(/\s*:\s*/, $val );                                          my ( $n, $v ) = split(/\s*:\s*/, $val );
148                                          push @attrs, { type => $_->{type} . '_' . $n, vals => [ $v ] };                                          push @attrs, { type => $attr->{type} . '_' . $n, vals => [ $v ] };
149                                  }                                  }
150                          }                          }
151                  }                  }
# Line 154  sub log_response { Line 154  sub log_response {
154    
155                  push @{ $response->{protocolOp}->{searchResEntry}->{attributes} }, $_ foreach @attrs;                  push @{ $response->{protocolOp}->{searchResEntry}->{attributes} }, $_ foreach @attrs;
156    
157                  my $path = $config->{yaml_dir} . "$uid.yaml";                  my @additional_yamls = ( $uid );
158                  if ( -e $path ) {                  foreach my $attr ( @{ $response->{protocolOp}->{searchResEntry}->{attributes} } ) {
159                          my $data = LoadFile($path);                          foreach my $v ( @{ $attr->{vals} } ) {
160                          warn "# yaml = ",dump($data);                                  push @additional_yamls, $attr->{type} . '/' . $v;
161                            }
162                    }
163    
164                    #warn "# additional_yamls ",dump( @additional_yamls );
165    
166                    foreach my $path ( @additional_yamls ) {
167                            my $full_path = $config->{yaml_dir} . '/' . $path . '.yaml';
168                            next unless -e $full_path;
169    
170                            my $data = LoadFile( $full_path );
171                            warn "# $full_path yaml = ",dump($data);
172    
173                          foreach my $type ( keys %$data ) {                          foreach my $type ( keys %$data ) {
174    

Legend:
Removed from v.84  
changed lines
  Added in v.99

  ViewVC Help
Powered by ViewVC 1.1.26