Skip to content

Commit

Permalink
Check whether LDAP socket object has a peerhost() method defined
Browse files Browse the repository at this point in the history
before calling it. This fixes SASL authentication over UNIX domain
(ldapi://) sockets.
  • Loading branch information
Chris Mikkelson committed Apr 28, 2011
1 parent 0a55dd1 commit 163be7b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Net/LDAP.pm
Expand Up @@ -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 {
Expand Down

0 comments on commit 163be7b

Please sign in to comment.