Commit fcb8e6b3 authored by Maxime Besson's avatar Maxime Besson

Use keepalive for LDAP connections (#2344)

parent ca97628c
......@@ -91,8 +91,9 @@ sub ldap {
# Connect
my $ldap = Net::LDAP->new(
\@servers,
onerror => undef,
verify => ( $self->{ldapVerify} || "require" ),
keepalive => 1,
onerror => undef,
verify => ( $self->{ldapVerify} || "require" ),
( $self->{ldapCAFile} ? ( cafile => $self->{ldapCAFile} ) : () ),
( $self->{ldapCAPath} ? ( capath => $self->{ldapCAPath} ) : () ),
( $self->{ldapPort} ? ( port => $self->{ldapPort} ) : () ),
......
......@@ -486,7 +486,8 @@ sub _ldap {
# Connect
my $ldap = Net::LDAP->new(
\@servers,
onerror => undef,
onerror => undef,
keepalive => 1,
( $self->ldapPort ? ( port => $self->ldapPort ) : () ),
( $self->ldapVerify ? ( verify => $self->ldapVerify ) : () ),
( $self->ldapCAFile ? ( cafile => $self->ldapCAFile ) : () ),
......
......@@ -47,7 +47,8 @@ sub new {
}
$self = Net::LDAP->new(
\@servers,
onerror => undef,
onerror => undef,
keepalive => 1,
( $conf->{ldapPort} ? ( port => $conf->{ldapPort} ) : () ),
( $conf->{ldapTimeout} ? ( timeout => $conf->{ldapTimeout} ) : () ),
( $conf->{ldapVersion} ? ( version => $conf->{ldapVersion} ) : () ),
......@@ -66,7 +67,7 @@ sub new {
# socket when certificate validation fails. Net::LDAP does not catch
# it, and the process ends up crashing.
# As a precaution, make sure the underlying socket is doing fine:
if ( $self->socket->isa('IO::Socket::SSL')
if ( $self->socket->isa('IO::Socket::SSL')
and $self->socket->errstr < 0 )
{
$portal->logger->error(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment