diff --git a/lemonldap-ng-common/lemonldap-ng.ini b/lemonldap-ng-common/lemonldap-ng.ini index 3a99cf5d7..6bf6f201d 100644 --- a/lemonldap-ng-common/lemonldap-ng.ini +++ b/lemonldap-ng-common/lemonldap-ng.ini @@ -93,6 +93,9 @@ logLevel = warn [configuration] +; confTimeout: maximum time to get configuration (default 10) +;confTimeout = 5 + ; GLOBAL CONFIGURATION ACCESS TYPE ; (File, REST, SOAP, RDBI/CDBI, LDAP, YAMLFile) ; Set here the parameters needed to access to LemonLDAP::NG configuration. diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf.pm index 4df4941c6..c5a55f437 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf.pm @@ -403,9 +403,12 @@ sub _launch { my $res; eval { local $SIG{ALRM} = sub { die "TIMEOUT\n" }; - alarm ($self->{confTimeout} || 10); - $res = &{ $self->{type} . "::$sub" }( $self, @_ ); + eval { + alarm( $self->{confTimeout} || 10 ); + $res = &{ $self->{type} . "::$sub" }( $self, @_ ); + }; alarm 0; + die $@ if $@; }; $msg .= $@ if $@; return $res; diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Session.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Session.pm index bad9a68f7..15de24dbe 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Session.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Session.pm @@ -166,19 +166,23 @@ sub _tie_session { eval { local $SIG{ALRM} = sub { die "TIMEOUT\n" }; - alarm $self->timeout; + eval { + alarm $self->timeout; - # SOAP/REST session module must be directly tied - if ( $self->storageModule =~ /^Lemonldap::NG::Common::Apache::Session/ ) - { - tie %h, $self->storageModule, $self->id, - { %{ $self->options }, %$options, kind => $self->kind }; - } - else { - tie %h, 'Lemonldap::NG::Common::Apache::Session', $self->id, - { %{ $self->options }, %$options }; - } + # SOAP/REST session module must be directly tied + if ( $self->storageModule =~ + /^Lemonldap::NG::Common::Apache::Session/ ) + { + tie %h, $self->storageModule, $self->id, + { %{ $self->options }, %$options, kind => $self->kind }; + } + else { + tie %h, 'Lemonldap::NG::Common::Apache::Session', $self->id, + { %{ $self->options }, %$options }; + } + }; alarm 0; + die $@ if $@; }; if ( $@ or not tied(%h) ) {