Permalink
Browse files

Check whether LDAP socket object has a peerhost() method defined

before calling it. This fixes SASL authentication over UNIX domain
(ldapi://) sockets.
  • Loading branch information...
1 parent 0a55dd1 commit 163be7b0661b5863ac02b523514e1359e1a1c3ce Chris Mikkelson committed Apr 28, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/Net/LDAP.pm
View
@@ -384,7 +384,10 @@ sub bind {
# If we're talking to a round-robin, the canonical name of
# the host we are talking to might not match the name we
# requested
- my $connected_name = $ldap->{net_ldap_socket}->peerhost;
+ my $connected_name;
+ if ($ldap->{net_ldap_socket}->can('peerhost')) {
+ $connected_name = $ldap->{net_ldap_socket}->peerhost;
+ }
$connected_name ||= $ldap->{net_ldap_host};
$sasl_conn = eval {

0 comments on commit 163be7b

Please sign in to comment.