Commit 3f7b7cca authored by Clément OUDOT's avatar Clément OUDOT

Apply r3627 in 1.4 branch (#LEMONLDAP-794)

git-svn-id: svn://svn.forge.objectweb.org/svnroot/lemonldap/branches/lemonldap-ng_version_1_4-bugfixes@3636 1dbb9719-a921-0410-b57f-c3a383c2c641
parent 8f2ad52c
......@@ -20,7 +20,7 @@ use Config::IniFiles;
#inherits Lemonldap::NG::Common::Conf::SOAP
#inherits Lemonldap::NG::Common::Conf::LDAP
our $VERSION = '1.4.1';
our $VERSION = '1.4.4';
our $msg;
our $iniObj;
......@@ -172,29 +172,20 @@ sub getConf {
}
else {
$r = $self->getDBConf($args);
}
}
return undef unless ( ref($r) );
# Adapt some values before storing in local cache
# Get default values
my $confAttributes = Lemonldap::NG::Common::Conf::Attributes->new();
my $confAttributes =
Lemonldap::NG::Common::Conf::Attributes->new();
my @attributes = $confAttributes->meta()->get_attribute_list();
foreach my $name (@attributes) {
unless ( defined $r->{$name} ) {
$r->{$name} = $confAttributes->$name;
}
$r->{$name} = $confAttributes->$name
unless ( defined $r->{$name} );
}
# Create cipher object
eval { $r->{cipher} = Lemonldap::NG::Common::Crypto->new( $r->{key} ); };
if ($@) {
$msg .= "Bad key: $@. \n";
return $r;
}
# Adapt some values
# Convert old option useXForwardedForIP into trustedProxies
if ( defined $r->{useXForwardedForIP}
and $r->{useXForwardedForIP} == 1 )
......@@ -219,6 +210,15 @@ sub getConf {
$self->setLocalConf($r)
if ( $self->{refLocalStorage} and not( $args->{noCache} ) );
}
}
# Create cipher object
eval { $r->{cipher} = Lemonldap::NG::Common::Crypto->new( $r->{key} ); };
if ($@) {
$msg .= "Bad key: $@. \n";
}
# Return configuration hash
return $r;
}
......@@ -343,7 +343,9 @@ sub getDBConf {
my $conf = $self->load( $args->{cfgNum} );
$msg .= "Get configuration $conf->{cfgNum}.\n";
$self->setLocalConf($conf)
if ( $self->{refLocalStorage} and not( $args->{noCache} ) );
if ( ref($conf)
and $self->{refLocalStorage}
and not( $args->{noCache} ) );
return $conf;
}
......
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