summaryrefslogtreecommitdiffstats
path: root/perl-install/security
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2002-11-15 09:31:51 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2002-11-15 09:31:51 +0000
commit4ca3ff5b333ef5835e446118098e1f4f276334e8 (patch)
treed5660127ca416b0533d47afd31703d919d37aab1 /perl-install/security
parentb92053e0e9f9604f7b348215286ed5a2ab285e99 (diff)
downloaddrakx-backup-do-not-use-4ca3ff5b333ef5835e446118098e1f4f276334e8.tar
drakx-backup-do-not-use-4ca3ff5b333ef5835e446118098e1f4f276334e8.tar.gz
drakx-backup-do-not-use-4ca3ff5b333ef5835e446118098e1f4f276334e8.tar.bz2
drakx-backup-do-not-use-4ca3ff5b333ef5835e446118098e1f4f276334e8.tar.xz
drakx-backup-do-not-use-4ca3ff5b333ef5835e446118098e1f4f276334e8.zip
- use run_program rather than raw system
- kill useless show_msec_help() - kill commented remanant code of help buttons - add tooltip with default values on combos & entries - log about security administrator changes only when we do some - factorize some code into new_editable_combo() and set_default_tip()
Diffstat (limited to 'perl-install/security')
-rw-r--r--perl-install/security/main.pm42
1 files changed, 26 insertions, 16 deletions
diff --git a/perl-install/security/main.pm b/perl-install/security/main.pm
index 362bb1450..7b3f5f0df 100644
--- a/perl-install/security/main.pm
+++ b/perl-install/security/main.pm
@@ -5,6 +5,7 @@ use strict;
use standalone;
use common;
use my_gtk qw(:helpers :wrappers :ask);
+use run_program;
use security::msec;
@@ -25,8 +26,6 @@ sub wait_msg {
sub remove_wait_msg { $_[0]->destroy }
-#sub show_msec_help { my $command = $_[0] }
-
sub basic_seclevel_explanations {
my $text = new Gtk::Text(undef, undef);
$text->set_editable(0);
@@ -64,6 +63,17 @@ sub basic_seclevel_option {
new Gtk::Label(N("Security Level:")), $$seclevel_entry;
}
+sub new_editable_combo {
+ my $w = new Gtk::Combo();
+ $w->entry->set_editable(0);
+ $w;
+}
+
+sub set_default_tip {
+ my ($entry, $default) = @_;
+ gtkset_tip(new Gtk::Tooltips, $entry, N(" (default value: %s)", $default));
+}
+
sub draksec_main {
my $msec = new security::msec;
my $w = my_gtk->new('draksec');
@@ -119,22 +129,24 @@ sub draksec_main {
create_packtable({ col_spacings => 10, row_spacings => 5 },
map {
my $i = $_;
+
+ my $entry;
my $default = $msec->get_function_default($i);
if (member($default, @all_choices)) {
- $values{$i} = new Gtk::Combo();
- $values{$i}->entry->set_editable(0);
+ $values{$i} = new_editable_combo();
+ $entry = $values{$i}->entry;
if (member($default, @yesno_choices)) {
$values{$i}->set_popdown_strings(@yesno_choices);
} elsif (member($default, @alllocal_choices)) {
$values{$i}->set_popdown_strings(@alllocal_choices);
}
- $values{$i}->entry->set_text($msec->get_function_value($i));
} else {
$values{$i} = new Gtk::Entry();
- $values{$i}->set_text($msec->get_function_value($i));
+ $entry = $values{$i};
}
- [ new Gtk::Label($i . N(" (default: %s)", $default)), $values{$i} ];
- # , gtksignal_connect(new Gtk::Button(N("Help")), 'clicked' => sub { show_msec_help($_) } ) ]
+ $entry->set_text($msec->get_function_value($i));
+ set_default_tip($entry, $default);
+ [ new Gtk::Label($i), $values{$i} ];
} $msec->get_functions($domain))))),
new Gtk::Label($label));
$options_values{$domain} = \%values;
@@ -149,12 +161,12 @@ sub draksec_main {
map {
my $i = $_;
if (!member(qw(MAIL_WARN MAIL_USER), $i)) {
- $security_checks_value{$i} = new Gtk::Combo();
- $security_checks_value{$i}->entry->set_editable(0);
+ $security_checks_value{$i} = new_editable_combo();
+ my $entry = $security_checks_value{$i}->entry;
+ set_default_tip($entry, $msec->get_check_default);
$security_checks_value{$i}->set_popdown_strings(qw(yes no default));
- $security_checks_value{$i}->entry->set_text($msec->get_check_value($i));
+ $entry->set_text($msec->get_check_value($i));
[ gtkshow(new Gtk::Label(translate($i))), $security_checks_value{$i} ];
- # , gtksignal_connect(new Gtk::Button(N("Help")), 'clicked' => sub { show_msec_help($i) } ) ]
}
} ($msec->get_default_checks))))),
new Gtk::Label(N("Periodic Checks")));
@@ -181,8 +193,8 @@ sub draksec_main {
standalone::explanations("Setting security administrator option");
$msec->config_check('MAIL_WARN', $secadmin_check_value == 1 ? 'yes' : 'no');
- standalone::explanations("Setting security administrator contact");
if ($secadmin_value ne $msec->get_check_value('MAIL_USER') && $secadmin_check_value) {
+ standalone::explanations("Setting security administrator contact");
$msec->config_check('MAIL_USER', $secadmin_value);
}
@@ -201,9 +213,7 @@ sub draksec_main {
}
}
standalone::explanations("Applying msec changes");
- system "/usr/sbin/msec";
-
-
+ run_program::run($::prefix, "/usr/sbin/msec");
remove_wait_msg($w);