summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorChristian Belisle <cbelisle@mandriva.com>2002-07-31 14:30:59 +0000
committerChristian Belisle <cbelisle@mandriva.com>2002-07-31 14:30:59 +0000
commitc6dde53bebf7318ee441af8b19acc46917394c24 (patch)
tree0f6337e21e835f4e1d286a0fb3cc917b6f5882c5 /perl-install
parentc5c6939571585f8c5a0394aec05436abd4c30f24 (diff)
downloaddrakx-c6dde53bebf7318ee441af8b19acc46917394c24.tar
drakx-c6dde53bebf7318ee441af8b19acc46917394c24.tar.gz
drakx-c6dde53bebf7318ee441af8b19acc46917394c24.tar.bz2
drakx-c6dde53bebf7318ee441af8b19acc46917394c24.tar.xz
drakx-c6dde53bebf7318ee441af8b19acc46917394c24.zip
- factorize functions (many functions -> one function)
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/security/main.pm65
1 files changed, 31 insertions, 34 deletions
diff --git a/perl-install/security/main.pm b/perl-install/security/main.pm
index 3d413edbd..65e346b7b 100644
--- a/perl-install/security/main.pm
+++ b/perl-install/security/main.pm
@@ -9,42 +9,40 @@ use log;
use security::msec;
use security::libsafe;
-sub basic_page {
- my ($prefix, $in) = @_;
- my $security = security::msec::get_secure_level('');
- my $libsafe = security::libsafe::config_libsafe('');
- my $sec_user = security::msec::config_security_user('');
- my $signal = 9;
-
- if(security::msec::choose_security_level($in, \$security, \$libsafe, \$sec_user, \$signal)) {
- log::l("[draksec] Setting libsafe activation variable to $libsafe");
- security::libsafe::config_libsafe('', $libsafe);
-
- log::l("[draksec] Setting security administrator contact to $sec_user");
- security::msec::config_security_user('', $sec_user);
-
-# my $w = $in->wait_message('', _("Setting security level"));
-# $in->suspend;
- $ENV{LILO_PASSWORD} = ''; # make it non interactive
- log::l("[draksec] Setting security level to $security");
- system "/usr/sbin/msec", $security;
-# $in->resume;
- }
- $signal;
-}
-
-sub functions_page {
- my ($prefix, $in) = @_;
+sub show_page {
+ my ($prefix, $in, $page) = @_;
my $signal = 9;
my $security = security::msec::get_secure_level('');
- my %functions = security::msec::get_options('', $security);
my $key = '';
+ my %options = ();
+ my ($sec_user, $libsafe) = '';
- if(security::msec::choose_options($in, \%functions, \$signal, $security)) {
- foreach $key (keys %functions) {
- security::msec::set_option('', $key, $functions{$key});
- }
+ if($page == 0) {
+ $libsafe = security::libsafe::config_libsafe('');
+ $sec_user = security::msec::config_security_user('');
}
+ elsif($page == 1) { %options = security::msec::get_options('', "functions"); }
+ elsif($page == 2) { %options = security::msec::get_options('', "checks"); }
+
+ if ($page == 2) {
+ if(security::msec::choose_checks($in, \%options, \$signal, $security)) {
+ foreach $key (keys %options) {
+ security::msec::set_check('', $key, $options{$key});
+ } } }
+ elsif ($page == 1) {
+ if(security::msec::choose_options($in, \%options, \$signal, $security)) {
+ foreach $key (keys %options) {
+ security::msec::config_option('', $key, $options{$key});
+ } } }
+ elsif ($page == 0) {
+ if(security::msec::choose_security_level($in, \$security, \$libsafe, \$sec_user, \$signal)) {
+ security::libsafe::config_libsafe('', $libsafe);
+ security::msec::config_security_user('', $sec_user);
+ $ENV{LILO_PASSWORD} = ''; # make it non interactive
+ log::l("[draksec] Setting security level to $security");
+ system "/usr/sbin/msec", $security;
+ } }
+
$signal;
}
@@ -61,9 +59,8 @@ sub main {
# signal 5 = users page
# signal 9 = quit
- if ($signal == 0) { $signal = basic_page($prefix, $in); }
- elsif ($signal == 1) { $signal = functions_page($prefix, $in); }
- }
+ $signal = show_page($prefix, $in, $signal);
+ }
}
1;