From 42e24b3df92f94bbd493de1870ab93b0b8aa66c5 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Tue, 17 Mar 2009 09:39:05 +0000 Subject: [PATCH 1/1] better errors if sockets can't be opened --- bin/ldap-rewrite.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/ldap-rewrite.pl b/bin/ldap-rewrite.pl index 6d63f5d..db97950 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 => 'localhost:1389', upstream_ldap => 'ldap.ffzg.hr', upstream_ssl => 1, overlay_prefix => 'ffzg-', @@ -177,7 +177,7 @@ my $listenersock = IO::Socket::INET->new( Proto => 'tcp', Reuse => 1, LocalAddr => $config->{listen}, -); +) || die "can't open listen socket: $!"; my $targetsock = $config->{upstream_ssl} @@ -187,7 +187,10 @@ my $targetsock = $config->{upstream_ssl} PeerPort => 389, ) : IO::Socket::SSL->new( $config->{upstream_ldap} . ':ldaps') - ; + || die "can't open upstream socket: $!"; + +binmode( $listenersock ); +binmode( $targetsock ); run_proxy($listenersock,$targetsock); -- 2.20.1