Lemonldap-NG-Common
view release on metacpan or search on metacpan
eg/llng-pubsub-server view on Meta::CPAN
}
my %args = (
( $a ? ( LocalAddr => $a ) : () ),
LocalPort => $p,
Listen => $maxWaitingConn,
ReuseAddr => 1,
ReusePort => 1,
);
if ($cert) {
require IO::Socket::SSL;
$server = IO::Socket::SSL->new(
%args,
SSL_cert_file => $cert,
SSL_key_file => $key,
SSL_server => 1,
);
}
else {
require IO::Socket::IP;
$server = IO::Socket::IP->new( %args, Proto => 'tcp', );
}
lib/Lemonldap/NG/Common/Conf/Backends/LDAP.pm view on Meta::CPAN
( $self->{ldapPort} ? ( port => $self->{ldapPort} ) : () ),
raw => => qr/(?i:^jpegPhoto|;binary)/
);
unless ($ldap) {
$Lemonldap::NG::Common::Conf::msg .= "$@\n";
return;
}
elsif ( $Net::LDAP::VERSION < '0.64' ) {
# CentOS7 has a bug in which IO::Socket::SSL will return a broken
# 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 ( $ldap->socket->isa('IO::Socket::SSL')
and $ldap->socket->errstr < 0 )
{
$Lemonldap::NG::Common::Conf::msg .=
"SSL connection error: " . $ldap->socket->errstr;
return;
}
}
# Start TLS if needed
if ($useTls) {
lib/Lemonldap/NG/Common/MessageBroker/Web.pm view on Meta::CPAN
package Lemonldap::NG::Common::MessageBroker::Web;
use strict;
use IO::Socket::INET;
use IO::Socket::SSL;
use IO::Select;
use Lemonldap::NG::Common::FormEncode;
use Lemonldap::NG::Common::UserAgent;
use JSON;
use Protocol::WebSocket::Client;
our $VERSION = '2.22.0';
use constant DEFAULTWS => 'localhost:8080';
our $pr = '::MessageBroker::Web:';
lib/Lemonldap/NG/Common/MessageBroker/Web.pm view on Meta::CPAN
Timeout => 5,
)
or do {
$self->logger->error("$pr Failed to connect to $self->{server}: $!");
$self->{connected} = 0;
return;
};
$self->logger->debug("$pr connected");
if ( $self->{ssl} ) {
$sock = IO::Socket::SSL->start_SSL( $sock, SSL_verify_mode => 0 )
or do {
$self->logger->error("$pr SSL error: $!");
$self->{connected} = 0;
return;
};
$self->logger->debug("$pr connection upgraded to TLS");
}
my $url = "ws$self->{ssl}://$self->{server}/subscribe?"
. build_urlencoded( channels => $self->{channels} );
$self->logger->debug("$pr connects to $url");
lib/Lemonldap/NG/Common/Notifications/LDAP.pm view on Meta::CPAN
( $self->ldapCAFile ? ( cafile => $self->ldapCAFile ) : () ),
( $self->ldapCAPath ? ( capath => $self->ldapCAPath ) : () ),
);
unless ($ldap) {
use Data::Dumper;
die 'connexion failed: ' . $@;
}
elsif ( $Net::LDAP::VERSION < '0.64' ) {
# CentOS7 has a bug in which IO::Socket::SSL will return a broken
# 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 ( $ldap->socket->isa('IO::Socket::SSL')
and $ldap->socket->errstr < 0 )
{
die "SSL connection error: " . $ldap->socket->errstr;
}
}
# Start TLS if needed
if ($useTls) {
my %h = split( /[&=]/, $tlsParam );
$h{cafile} ||= $self->ldapCAFile if ( $self->ldapCAFile );
( run in 0.561 second using v1.01-cache-2.11-cpan-1d5ca39e368 )