X-Git-Url: http://git.rot13.org/?p=virtual-ldap;a=blobdiff_plain;f=bin%2Fldap-rewrite.pl;h=9c57242be9c6ceec70908ec6c97443b5cc070804;hp=6d63f5d30952cc7c1532797d00827a3cc87637c6;hb=b3ce3ad0c105c022cc9b048a5f93c7eaaa0f4931;hpb=09e629fb1967f0f079d83d076a4604850ec86a64 diff --git a/bin/ldap-rewrite.pl b/bin/ldap-rewrite.pl index 6d63f5d..9c57242 100755 --- a/bin/ldap-rewrite.pl +++ b/bin/ldap-rewrite.pl @@ -20,7 +20,7 @@ use YAML qw/LoadFile/; my $config = { yaml_dir => './yaml/', - listen => 'localhost:2389', + listen => shift @ARGV || 'localhost:1389', upstream_ldap => 'ldap.ffzg.hr', upstream_ssl => 1, overlay_prefix => 'ffzg-', @@ -99,7 +99,7 @@ sub log_response { if ( defined $response->{protocolOp}->{searchResEntry} ) { my $uid = $response->{protocolOp}->{searchResEntry}->{objectName}; - warn "## SEARCH $uid"; + warn "## objectName $uid"; my @attrs; @@ -170,14 +170,12 @@ sub run_proxy { } -$ENV{LANG} = 'C'; # so we don't double-encode utf-8 if LANG is utf-8 - my $listenersock = IO::Socket::INET->new( Listen => 5, Proto => 'tcp', Reuse => 1, LocalAddr => $config->{listen}, -); +) || die "can't open listen socket: $!"; my $targetsock = $config->{upstream_ssl} @@ -187,7 +185,7 @@ my $targetsock = $config->{upstream_ssl} PeerPort => 389, ) : IO::Socket::SSL->new( $config->{upstream_ldap} . ':ldaps') - ; + || die "can't open upstream socket: $!"; run_proxy($listenersock,$targetsock);