From 111ce9f21f987c315c4fee080605bb07febb0224 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 4 Feb 2003 07:33:45 +0000 Subject: - fix get_check_default() and get_function_default() description - fix "check states were not saved if their value did not change (thus reverting it to default on disk)" - fix emebedding (no transcience when embedded) - fix "value get chop()-ed until it disapear and is reset to default" - log which security level is set and not only the switch killing latest remanent parts of christian "yeah baby, i'm piggy" work: - functions and checks listing : o rename get_functions() as list_functions() and get_default_checks() as list_checks(); this is both more homogenous and enable one to separate them from the get_(check|function)_(value|default) function group o regroup them o over simplify list_functions(): leave functions listing to msec (aka /usr/share/msec/level., assuming share/msec.py is always up to date, just don't care reparsing python code (this is plain stupid); if we cannot rely on msec, on who could we :-) ? o this allow to simplify msec gui so that we do not exclude stuff already excluded - remove config_check(), config_funtion(): replace them by: o set_check() and set_function() to store new values in data structure o apply_checks() and apply_functions() to save these new values, thus writing config files once and not twice the functions & checks count --- perl-install/standalone/draksec | 44 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'perl-install/standalone/draksec') diff --git a/perl-install/standalone/draksec b/perl-install/standalone/draksec index 234284513..57a2d8136 100755 --- a/perl-install/standalone/draksec +++ b/perl-install/standalone/draksec @@ -40,7 +40,7 @@ my $w; # factorize this with rpmdrake and harddrake2 sub wait_msg { - my $mainw = ugtk2->new('wait', ( modal => 1, transient => $w->{rwindow})); + my $mainw = ugtk2->new('wait', (modal => 1, if_(!$::isEmbedded, transient => $w->{rwindow}))); my $label = new Gtk2::Label($_[0]); $mainw->{window}->add($label); $mainw->{window}->show_all; @@ -178,7 +178,7 @@ foreach ([ 'network', N("Network Options") ], [ 'system', N("System Options") ]) $entry->set_text($msec->get_function_value($i)); set_help_tip($entry, $default, $i); [ new Gtk2::Label($i), $values{$i} ]; - } sort $msec->get_functions($domain))))), + } sort $msec->list_functions($domain))))), new Gtk2::Label($label)); $options_values{$domain} = \%values; } @@ -190,16 +190,14 @@ $notebook->append_page(gtkshow(create_scrolled_window(gtkpack_(new Gtk2::VBox(0, 0, new Gtk2::Label($help_msg), 1, create_packtable($common_opts, map { - unless (member(qw(MAIL_WARN MAIL_USER), $_)) { - my $i = $_; - $security_checks_value{$i} = new_editable_combo(); - my $entry = $security_checks_value{$i}->entry; - set_help_tip($entry, $msec->get_check_default($i), $i); - $security_checks_value{$i}->set_popdown_strings(qw(yes no default)); - $entry->set_text($msec->get_check_value($i)); - [ gtkshow(new Gtk2::Label(translate($i))), $security_checks_value{$i} ]; - } else { undef } - } sort $msec->get_default_checks)))), + my $i = $_; + $security_checks_value{$i} = new_editable_combo(); + my $entry = $security_checks_value{$i}->entry; + set_help_tip($entry, $msec->get_check_default($i), $i); + $security_checks_value{$i}->set_popdown_strings(qw(yes no default)); + $entry->set_text($msec->get_check_value($i)); + [ gtkshow(new Gtk2::Label(translate($i))), $security_checks_value{$i} ]; + } sort $msec->list_checks)))), new Gtk2::Label(N("Periodic Checks"))); @@ -215,34 +213,34 @@ my $bok = gtksignal_connect(new Gtk2::Button(N("Ok")), if ($seclevel_value ne security::level::get_string()) { $w = wait_msg(N("Please wait, setting security level...")); - log::explanations("Setting security level"); + log::explanations("Setting security level to $seclevel_value"); security::level::set($seclevel_value); remove_wait_msg($w); } $w = wait_msg(N("Please wait, setting security options...")); log::explanations("Setting security administrator option"); - $msec->config_check('MAIL_WARN', $secadmin_check_value == 1 ? 'yes' : 'no'); + $msec->set_check('MAIL_WARN', $secadmin_check_value == 1 ? 'yes' : 'no'); if ($secadmin_value ne $msec->get_check_value('MAIL_USER') && $secadmin_check_value) { log::explanations("Setting security administrator contact"); - $msec->config_check('MAIL_USER', $secadmin_value); + $msec->set_check('MAIL_USER', $secadmin_value); } log::explanations("Setting security periodic checks"); foreach my $key (keys %security_checks_value) { - if ($security_checks_value{$key}->entry->get_text() ne $msec->get_check_value($key)) { - $msec->config_check($key, $security_checks_value{$key}->entry->get_text()); - } + $msec->set_check($key, $security_checks_value{$key}->entry->get_text()); } + $msec->apply_checks; foreach my $domain (keys %options_values) { log::explanations("Setting msec functions related to $domain"); - foreach my $key (keys %{$options_values{$domain}}) { - my $opt = $options_values{$domain}{$key}; - $msec->config_function($key, $opt =~ /Combo/ ? $opt->entry->get_text() : $opt->get_text()); - } - } + foreach my $key (keys %{$options_values{$domain}}) { + my $opt = $options_values{$domain}{$key}; + $msec->set_function($key, $opt =~ /Combo/ ? $opt->entry->get_text() : $opt->get_text()); + } + } + $msec->apply_functions; log::explanations("Applying msec changes"); run_program::rooted($::prefix, "/usr/sbin/msec"); -- cgit v1.2.1