/[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 19 by dpavlin, Mon Mar 16 09:46:47 2009 UTC revision 27 by dpavlin, Mon Mar 16 18:11:12 2009 UTC
# Line 24  my $config = { Line 24  my $config = {
24          upstream_ldap => 'ldap.ffzg.hr',          upstream_ldap => 'ldap.ffzg.hr',
25          upstream_ssl => 1,          upstream_ssl => 1,
26          overlay_prefix => 'ffzg-',          overlay_prefix => 'ffzg-',
27            log_file => 'log',
28    
29  };  };
30    
31    my $log_fh;
32    
33    sub log {
34            open($log_fh, '>', $config->{log_file}) || die "can't open ", $config->{log_file},": $!";
35            $log_fh->autoflush(1);
36            print $log_fh join("\n", @_),"\n";
37    }
38    
39    BEGIN {
40            $SIG{'__WARN__'} = sub { warn @_; main::log(@_); }
41    }
42    
43    
44  if ( ! -d $config->{yaml_dir} ) {  if ( ! -d $config->{yaml_dir} ) {
45          warn "DISABLE ", $config->{yaml_dir}," data overlay";          warn "DISABLE ", $config->{yaml_dir}," data overlay";
46  }  }
# Line 108  sub log_response { Line 122  sub log_response {
122                          foreach my $type ( keys %$data ) {                          foreach my $type ( keys %$data ) {
123    
124                                  my $vals = $data->{$type};                                  my $vals = $data->{$type};
                                 $vals =~ s{#\s*$}{};  
                                   
                                 my @vals = split(/\s*#\s*/, $vals);  
125    
126                                  push @{ $response->{protocolOp}->{searchResEntry}->{attributes} },                                  push @{ $response->{protocolOp}->{searchResEntry}->{attributes} }, {
127                                          { type => $config->{overlay_prefix} . $type, vals => [ @vals ] };                                          type => $config->{overlay_prefix} . $type,
128                                            vals => ref($vals) eq 'ARRAY' ? $vals : [ $vals ],
129                                    };
130                          }                          }
131                  }                  }
132    
# Line 154  sub run_proxy { Line 167  sub run_proxy {
167  }  }
168    
169    
170    $ENV{LANG} = 'C'; # so we don't double-encode utf-8 if LANG is utf-8
171    
172  my $listenersock = IO::Socket::INET->new(  my $listenersock = IO::Socket::INET->new(
173          Listen => 5,          Listen => 5,
174          Proto => 'tcp',          Proto => 'tcp',

Legend:
Removed from v.19  
changed lines
  Added in v.27

  ViewVC Help
Powered by ViewVC 1.1.26