From e22ce2c6238ae5b238a01e7a443a782409d65126 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 20 Feb 2002 12:37:51 +0000 Subject: factorize and update the reading of previous security level --- perl-install/any.pm | 9 +++++++++ perl-install/install_steps.pm | 4 ++-- perl-install/standalone/draksec | 7 ++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/perl-install/any.pm b/perl-install/any.pm index 4c12bf712..a2a81e502 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -1064,4 +1064,13 @@ sub ask_window_manager_to_logout { 1; } +sub get_secure_level { + my ($prefix) = @_; + + cat_("/etc/profile") =~ /export SECURE_LEVEL=(\d+)/ && $1 || #- 8.0 msec + cat_("/etc/profile.d/msec.sh") =~ /export SECURE_LEVEL=(\d+)/ && $1 || #- 8.1 msec + ${{ getVarsFromSh("$prefix/etc/sysconfig/msec") }}{SECURE_LEVEL} || #- 8.2 msec + $ENV{SECURE_LEVEL}; +} + 1; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index ced2cd281..41b59882e 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -918,8 +918,8 @@ sub miscellaneousBefore { my ($o) = @_; my %s = getVarsFromSh("$o->{prefix}/etc/sysconfig/system"); - $o->{miscellaneous}{HDPARM} ||= $s{HDPARM} if exists $s{HDPARM}; - $o->{security} ||= $s{SECURITY} if exists $s{SECURITY}; + $o->{miscellaneous}{HDPARM} = $s{HDPARM} if exists $s{HDPARM}; + $o->{security} = any::get_secure_level($o->{prefix}) || $o->{security}; add2hash_($o->{miscellaneous} ||= {}, { numlock => !detect_devices::isLaptop() }); } diff --git a/perl-install/standalone/draksec b/perl-install/standalone/draksec index 9cf75788f..1fed07193 100755 --- a/perl-install/standalone/draksec +++ b/perl-install/standalone/draksec @@ -6,7 +6,7 @@ use standalone; #- warning, standalone must be loaded very first, for 'expla use common; use interactive; -use mouse; +use any; use c; local $_ = join '', @ARGV; @@ -21,10 +21,7 @@ my $in = 'interactive'->vnew('su', 'security'); begin: $::isEmbedded and kill USR2, $::CCPID; - -my $security = - cat_("/etc/profile.d/msec.sh") =~ /export SECURE_LEVEL=(\d+)/ ? $1 : - $ENV{SECURE_LEVEL} || 2; +my $security = any::get_secure_level(''); my $libsafe = any::config_libsafe(''); if (any::choose_security_level($in, \$security, \$libsafe)) { -- cgit v1.2.1