1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 N_(155 156 157 158 159 160 161 162 163 N_("Brazil") => [ 'Brazil/East' ], N_("Canada") => [ 'Canada/Atlantic', 'Canada/Eastern' ], N_("Costa Rica") => [ 'America/Costa_Rica' ], N_("Czech Republic") => [ 'Europe/Prague', 'Europe/Berlin' ], N_("Denmark") => [ 'Europe/Copenhagen', 'Europe/Berlin' ], N_("Estonia") => [ 'Europe/Tallinn', 'Europe/Helsinki' ], N_("Finland") => [ 'Europe/Helsinki', 'Europe/Tallinn' ], N_("France") => [ 'Europe/Paris', 'Europe/Brussels', 'Europe/Berlin' ], N_("Germany") => [ 'Europe/Berlin', 'Europe/Prague' ], N_("Greece") => [ 'Europe/Athens', 'Europe/Prague' ], N_("Hungary") => [ 'Europe/Budapest' ], N_("Ireland") => [ 'Europe/Dublin', 'Europe/London' ], N_("Israel") => [ 'Asia/Tel_Aviv' ], N_("Italy") => [ 'Europe/Rome', 'Europe/Brussels', 'Europe/Paris' ], N_("Japan") => [ 'Asia/Tokyo', 'Asia/Seoul' ], N_("Netherlands") => [ 'Europe/Amsterdam', 'Europe/Brussels', 'Europe/Berlin' ], N_("New Zealand") => [ 'Pacific/Auckland' ], N_("Norway") => [ 'Europe/Oslo', 'Europe/Stockholm' ], N_("Poland") => [ 'Europe/Warsaw' ], N_("Portugal") => [ 'Europe/Lisbon', 'Europe/Madrid' ], N_("Russia") => [ 'Europe/Moscow', ], N_("Slovakia") => [ 'Europe/Bratislava' ], N_("South Africa") => [ 'Africa/Johannesburg' ], N_("Spain") => [ 'Europe/Madrid', 'Europe/Lisbon' ], N_("Sweden") => [ 'Europe/Stockholm', 'Europe/Oslo' ], N_(sub mirrors_raw { my ($product_id) = @_; #- contact the following URL to retrieve the list of mirrors. #- http://wiki.mandriva.com/en/Product_id my $type = lc($product_id->{type}); $type =~ s/\s//g; my $list = "http://api.mandriva.com/mirrors/$type.$product_id->{version}.$product_id->{arch}.list?product=$product_id->{product}"; log::explanations("trying mirror list from $list"); my @lines; if ($::isInstall) { require install::http; my $f = install::http::getFile($list) or die "mirror list not found"; local $SIG{ALRM} = sub { die "timeout" }; alarm 60; log::l("using mirror list $list"); push @lines, $_ while <$f>; install::http::close(); alarm 0; } else { if (ref($downloader)) { @lines = $downloader->($list); @lines or die "mirror list not found"; } else { die "Missing download callback"; } } map { common::parse_LDAP_namespace_structure(chomp_($_)) } @lines; } sub list { my ($product_id, $type) = @_; our @mirrors_raw;= security::level::get_string(); push(@sec_levels, $current_level) unless member($current_level, @sec_levels); $seclevel_entry = new_nonedit_combo(\@sec_levels, $current_level); Gtk2::WrappedLabel->new(N("Security Level:")), $seclevel_entry; } ], [ Gtk2::WrappedLabel->new(N("Security Alerts:")), my $secadmin_check = gtksignal_connect(Gtk2::CheckButton->new, toggled => sub { $secadmin_entry->set_sensitive($_[0]->get_active); }) ], [ Gtk2::WrappedLabel->new(N("Security Administrator:")), $secadmin_entry = Gtk2::Entry->new_with_text($msec->get_check_value("MAIL_USER")) ]))), Gtk2::Label->new(N("Basic options"))); if ($msec->get_check_value("MAIL_WARN") eq "yes") { $secadmin_check->set_active(1); } else { $secadmin_entry->set_sensitive(0); } ######################### NETWORK & SYSTEM OPTIONS ######################### my @yesno_choices = qw(yes no default ignore); my @alllocal_choices = qw(ALL LOCAL NONE default); my @all_choices = (@yesno_choices, @alllocal_choices); my %options_values; foreach ([ 'network', N("Network Options") ], [ 'system', N("System Options") ]) { my ($domain, $label) = @$_; register_help_page($label); my %values; gtkappend_page($notebook, gtkshow(gtkpack_(Gtk2::VBox->new, 1, create_scrolled_window(create_packtable($common_opts, map { my $i = $_; my $entry; my $opt = $inv_fields{$i} || $i; my $default = $msec->get_function_default($opt); if (member($default, @all_choices)) { $values{$i} = new_nonedit_combo(member($default, @yesno_choices) ? \@yesno_choices : if_(member($default, @alllocal_choices), \@alllocal_choices)); $entry = $values{$i}->entry; } else { $values{$i} = Gtk2::Entry->new; $entry = $values{$i}; } $entry->set_text(to_i18n($msec->get_function_value($opt))); register_help_entry($i, $default, $opt); [ Gtk2::WrappedLabel->new($i), resize($values{$i}) ]; } sort map { $fields{$_} || $_ } $msec->list_functions($domain), ), [ 'never', 'automatic' ], ), ) ), Gtk2::WrappedLabel->new($label)); $options_values{$domain} = \%values; } ######################## PERIODIC CHECKS ################################### my %security_checks_value; my $check_string = N("Periodic Checks"); register_help_page($check_string); gtkappend_page($notebook, gtkshow(gtkpack_(Gtk2::VBox->new, 1, create_scrolled_window(create_packtable($common_opts, map { my $i = $_; my $opt = $inv_fields{$i} || $i; $security_checks_value{$i} = new_nonedit_combo([ 'yes', 'no', 'default' ], $msec->get_check_value($opt)); register_help_entry($i, $msec->get_check_default($opt), $opt); [ gtkshow(Gtk2::WrappedLabel->new($i)), resize($security_checks_value{$i}) ]; } sort map { $fields{$_} || $_ } $msec->list_checks)))), Gtk2::Label->new($check_string)); ####################### OK CANCEL BUTTONS ################################## gtkpack_($vbox, 1, gtkshow($notebook), 0, create_okcancel(my $oc = { cancel_clicked => sub { ugtk2->exit(0) }, ok_clicked => sub { my $seclevel_value = $seclevel_entry->entry->get_text; my $secadmin_check_value = $secadmin_check->get_active; my $secadmin_value = $secadmin_entry->get_text; my $w; log::explanations("Configuring msec"); if ($seclevel_value ne security::level::get_string()) { $w = wait_msg(N("Please wait, setting security level...")); log::explanations(qq(Setting security level to "$seclevel_value")); security::level::set(security::level::from_string($seclevel_value)); remove_wait_msg($w); } $w = wait_msg(N("Please wait, setting security options...")); log::explanations(qq(Setting security administrator option to ") . bool2yesno($secadmin_check_value) . '"'); $msec->set_check('MAIL_WARN', bool2yesno($secadmin_check_value)); if ($secadmin_value ne $msec->get_check_value('MAIL_USER') && $secadmin_check_value) { log::explanations(qq(Setting security administrator contact to "$secadmin_value")); $msec->set_check('MAIL_USER', $secadmin_value); } log::explanations("Setting security periodic checks"); foreach my $key (keys %security_checks_value) { $msec->set_check($inv_fields{$key} || $key, from_i18n($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->set_function($inv_fields{$key} || $key, from_i18n($opt->get_text)); } } $msec->apply_functions; log::explanations("Applying msec changes"); run_program::run("/usr/sbin/msec"); remove_wait_msg($w); ugtk2->exit(0); } }, undef, undef, '', [ N("Help"), sub { my $text = Gtk2::TextView->new; create_dialog(N("Help"), gtktext_insert($text, [ # -1 b/c of main page: @{$help[$notebook->get_current_page-1]} ] ), { use_markup => 1, if_(!$::isEmbedded, transient => $w->{real_window}), height => 400, width => 600, scroll => 1, }, ); } ], ), ); $notebook->signal_connect("switch-page" => sub { $oc->{buttons}{N("Help")}->set_sensitive($_[2]) }); $oc->{buttons}{N("Help")}->set_sensitive(0); $oc->{cancel}->can_default(1); $oc->{cancel}->grab_default; $w->main; ugtk2->exit(0);