Fix code warning messages in newer Perl installs

This commit is contained in:
Manuel Cillero 2020-04-12 12:50:11 +02:00
parent 58ead7c11f
commit 27ed9214ef
7 changed files with 48 additions and 22 deletions

View file

@ -138,7 +138,7 @@ sub cgiapp_prerun {
my ($download_mode, $filename_extension) = split(',', cgiapp_param('dm'));
my $package = $run_mode;
my @packages = split('::', $run_mode);
if (scalar(@packages) > 1) {
if (scalar @packages > 1) {
$package = pop(@packages);
$package = pop(@packages) if is_eq($package, $CURRENT_PACKAGE{RUN});
}
@ -200,9 +200,19 @@ sub APP_confirm {
return __login($user, 2, _t('User not active!'), _t('Consult with your systems manager to activate your user')) if $user_data[5] eq 0;
# Check if user is in the Active Directory:
my $ad = Authen::Simple::ActiveDirectory->new(host => CONFIG('LDAP_DOMAIN'), principal => CONFIG('LDAP_DOMAIN'), timeout => 20);
if (!$ad->authenticate($user, $pass)) {
# Unidentified user. Or is it a local user:
my $ad = undef;
if (!is_empty(CONFIG('AD_DOMAIN'))) {
if (!is_empty(CONFIG('AD_SERVER'))) {
$ad = Authen::Simple::ActiveDirectory->new(host => CONFIG('AD_SERVER'), principal => CONFIG('AD_DOMAIN'), timeout => 5);
$ad = undef if !$ad->authenticate($user, $pass);
}
if (!defined($ad)) {
$ad = Authen::Simple::ActiveDirectory->new(host => CONFIG('AD_DOMAIN'), principal => CONFIG('AD_DOMAIN'), timeout => 10);
$ad = undef if !$ad->authenticate($user, $pass);
}
}
# Check if user is local:
if (!defined($ad)) {
my $passcrypt = __crypt_password($pass);
# Unidentified user. Request the login again:
return __login($user, 3) if !defined($user_data[1]) || $user_data[1] ne $passcrypt;