32 |
upstream_ldap => 'ldap.ffzg.hr', |
upstream_ldap => 'ldap.ffzg.hr', |
33 |
upstream_ssl => 1, |
upstream_ssl => 1, |
34 |
overlay_prefix => 'ffzg-', |
overlay_prefix => 'ffzg-', |
35 |
log_file => 'log', |
# log_file => 'log/ldap-rewrite.log', |
36 |
|
|
37 |
}; |
}; |
38 |
|
|
39 |
my $log_fh; |
my $log_fh; |
40 |
|
|
41 |
sub log { |
sub log { |
42 |
|
return unless $config->{log_file}; |
43 |
|
|
44 |
if ( ! $log_fh ) { |
if ( ! $log_fh ) { |
45 |
open($log_fh, '>>', $config->{log_file}) || die "can't open ", $config->{log_file},": $!"; |
open($log_fh, '>>', $config->{log_file}) || die "can't open ", $config->{log_file},": $!"; |
46 |
print $log_fh "# " . time; |
print $log_fh "# " . time; |
103 |
if ( $request->{bindRequest}->{name} =~ m{@} ) { |
if ( $request->{bindRequest}->{name} =~ m{@} ) { |
104 |
my $old = $request->{bindRequest}->{name}; |
my $old = $request->{bindRequest}->{name}; |
105 |
$request->{bindRequest}->{name} =~ s/[@\.]/,dc=/g; |
$request->{bindRequest}->{name} =~ s/[@\.]/,dc=/g; |
106 |
$request->{bindRequest}->{name} =~ s/^/uid=/; |
$request->{bindRequest}->{name} =~ s/^/uid=/ unless $request->{bindRequest}->{name} =~ m/^uid=/; |
107 |
warn "rewrite bind cn $old -> ", $request->{bindRequest}->{name}; |
warn "rewrite bind cn $old -> ", $request->{bindRequest}->{name}; |
108 |
Convert::ASN1::asn_hexdump(\*STDOUT,$pdu) if $debug; |
Convert::ASN1::asn_hexdump(\*STDOUT,$pdu) if $debug; |
109 |
$pdu = $LDAPRequest->encode($request); |
$pdu = $LDAPRequest->encode($request); |