summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2002-09-18 09:03:23 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2002-09-18 09:03:23 +0000
commit6169b15726decf2f85edc49b9c1960b899792323 (patch)
treec15880cc4cf04ae1cc37f9383e3e26ff736563d6
parent9134a39788f54bbeb5d336b6ac4459141080c1f5 (diff)
downloaddrakx-backup-do-not-use-6169b15726decf2f85edc49b9c1960b899792323.tar
drakx-backup-do-not-use-6169b15726decf2f85edc49b9c1960b899792323.tar.gz
drakx-backup-do-not-use-6169b15726decf2f85edc49b9c1960b899792323.tar.bz2
drakx-backup-do-not-use-6169b15726decf2f85edc49b9c1960b899792323.tar.xz
drakx-backup-do-not-use-6169b15726decf2f85edc49b9c1960b899792323.zip
- factorize @sec_levels and %sec_levels for get_default() and
get_seclevel_list() - use them in get_default() - get_value() : don't assume a space between "function_name" and "(parameters)"
-rw-r--r--perl-install/security/msec.pm16
1 files changed, 7 insertions, 9 deletions
diff --git a/perl-install/security/msec.pm b/perl-install/security/msec.pm
index 59fff91da..eea69cf4a 100644
--- a/perl-install/security/msec.pm
+++ b/perl-install/security/msec.pm
@@ -57,6 +57,11 @@ use MDK::Common;
my $check_file = "$::prefix/etc/security/msec/security.conf";
+
+my @sec_levels = ("Dangerous", "Poor", "Standard", "High", "Higher", "Paranoid");
+my %sec_levels = ("Dangerous" => 0, "Poor" => 1, "Standard" => 2, "High" => 3, "Higher" => 4, "Paranoid" => 5);
+
+
# ***********************************************
# PRIVATE FUNCTIONS
# ***********************************************
@@ -69,12 +74,7 @@ sub get_default {
if ($category eq "functions") {
my $word_level = get_secure_level();
- if ($word_level eq "Dangerous") { $num_level = 0 }
- elsif ($word_level eq "Poor") { $num_level = 1 }
- elsif ($word_level eq "Standard") { $num_level = 2 }
- elsif ($word_level eq "High") { $num_level = 3 }
- elsif ($word_level eq "Higher") { $num_level = 4 }
- elsif ($word_level eq "Paranoid") { $num_level = 5 }
+ $num_level = $sec_levels{$word_level};
$default_file = "$::prefix/usr/share/msec/level.".$num_level;
}
elsif ($category eq "checks") { $default_file = "$::prefix/var/lib/msec/security.conf"; }
@@ -106,7 +106,7 @@ sub get_value {
if($_ =~ /^$item/) {
if ($category eq 'functions') {
my $i = $_;
- (undef, $_) = split / /;
+ (undef, $_) = split /\(/;
tr /()//d;
$value = $_;
$_ = $i;
@@ -142,7 +142,6 @@ sub get_secure_level {
${{ getVarsFromSh("$::prefix/etc/sysconfig/msec") }}{SECURE_LEVEL};
# || $ENV{SECURE_LEVEL};
- my @sec_levels = ("Dangerous", "Poor", "Standard", "High", "Higher", "Paranoid");
return $sec_levels[$num_level];}
sub get_seclevel_list {
@@ -152,7 +151,6 @@ sub get_seclevel_list {
sub set_secure_level {
my $word_level = $_[1];
- my %sec_levels = ("Dangerous" => 0, "Poor" => 1, "Standard" => 2, "High" => 3, "Higher" => 4, "Paranoid" => 5);
my $run_level = $sec_levels{$word_level};
system "/usr/sbin/msec", $run_level ? $run_level : 3;
}