Check if configuration is really stored (#441)

This commit is contained in:
Clément Oudot 2012-02-26 15:13:53 +00:00
parent b57f31e5c4
commit b10560bedb
2 changed files with 17 additions and 8 deletions

View File

@ -20,7 +20,7 @@ use Config::IniFiles;
#inherits Lemonldap::NG::Common::Conf::SOAP
#inherits Lemonldap::NG::Common::Conf::LDAP
our $VERSION = '1.1.0';
our $VERSION = '1.2.0';
our $msg;
our $iniObj;
@ -118,8 +118,16 @@ sub saveConf {
foreach my $k (qw(reVHosts cipher)) {
delete( $conf->{$k} );
}
$msg .= "Configuration $conf->{cfgNum} stored.\n";
# Try to store configuration
my $tmp = $self->store($conf);
unless ( $tmp > 0 ) {
$msg .= "Configuration $conf->{cfgNum} not stored.\n";
return ( $tmp ? $tmp : UNKNOWN_ERROR );
}
$msg .= "Configuration $conf->{cfgNum} stored.\n";
return ( $self->unlock() ? $tmp : UNKNOWN_ERROR );
}
@ -170,9 +178,9 @@ sub getConf {
"Warning: key is not defined, set it in the manager !\n"
unless ( $r->{key} );
eval {
$r->{cipher} = Lemonldap::NG::Common::Crypto->new(
$r->{key} || 'lemonldap-ng-key'
);
$r->{cipher} =
Lemonldap::NG::Common::Crypto->new( $r->{key}
|| 'lemonldap-ng-key' );
};
if ($@) {
$msg .= "Bad key: $@. \n";

View File

@ -20,7 +20,7 @@ use Lemonldap::NG::Manager::_Struct; #link protected struct _Struct object
use Lemonldap::NG::Manager::_i18n;
use Lemonldap::NG::Common::Conf::Constants; #inherits
our $VERSION = '1.1.0';
our $VERSION = '1.2.0';
our ( $stylesheet, $parser );
## @method void confUpload(ref rdata)
@ -458,11 +458,12 @@ s/^(samlSPMetaDataXML|samlSPMetaDataExportedAttributes|samlSPMetaDataOptions)\/(
SYNTAX_ERROR, 'syntaxError',
DEPRECATED, 'confModuledeprecated',
}->{ $errors->{result}->{cfgNum} }
|| $msg;
|| 'unknownError';
# Log failure using Lemonldap::NG::Common::CGI::userError()
$self->_sub( 'userError',
"Configuration rejected for $newConf->{cfgAuthor}: $msg" );
"Configuration rejected for $newConf->{cfgAuthor}: "
. $Lemonldap::NG::Common::Conf::msg );
}
# Translate msg returned