summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-07-27 10:14:35 +0000
committerOlivier Blin <oblin@mandriva.org>2005-07-27 10:14:35 +0000
commit42c260c43de82ffd6d11a61f172f1c938b8cc5a7 (patch)
tree895a97f89da2fd44be1eae0f496fe998a33a2f1f /perl-install/standalone
parentda079982e86d69b6a844b265096515bf0951cdce (diff)
downloaddrakx-backup-do-not-use-42c260c43de82ffd6d11a61f172f1c938b8cc5a7.tar
drakx-backup-do-not-use-42c260c43de82ffd6d11a61f172f1c938b8cc5a7.tar.gz
drakx-backup-do-not-use-42c260c43de82ffd6d11a61f172f1c938b8cc5a7.tar.bz2
drakx-backup-do-not-use-42c260c43de82ffd6d11a61f172f1c938b8cc5a7.tar.xz
drakx-backup-do-not-use-42c260c43de82ffd6d11a61f172f1c938b8cc5a7.zip
handle dbus failures
Diffstat (limited to 'perl-install/standalone')
-rw-r--r--perl-install/standalone/drakids34
1 files changed, 27 insertions, 7 deletions
diff --git a/perl-install/standalone/drakids b/perl-install/standalone/drakids
index b00bd9ec4..71c7a1339 100644
--- a/perl-install/standalone/drakids
+++ b/perl-install/standalone/drakids
@@ -7,6 +7,7 @@ use standalone;
use Socket;
use mygtk2 qw(gtknew);
+use ugtk2 qw(:dialogs);
use POSIX qw(strftime);
use dbus_object;
use network::activefw;
@@ -104,6 +105,7 @@ sub list_remove_addr {
}
}
+#- may throw an exception
sub init_blacklist() {
my @packets = $activefw->get_blacklist;
while (my @blacklist = splice(@packets, 0, 8)) {
@@ -138,11 +140,16 @@ sub get_selected_blacklist() {
sub unblacklist {
my @addr = @_;
- $activefw->unblacklist($_) foreach @addr;
- #- delete from the list even if the above calls were unsuccessful
+ eval { $activefw->unblacklist($_) foreach @addr };
+ if ($@) {
+ my $error = $@;
+ err_dialog(N("Error"), N("Unable to remove from blacklist: %s", $error));
+ return;
+ }
list_remove_addr($blacklist->{data}, @addr);
}
+#- may throw an exception
sub init_whitelist() {
handle_whitelist($_) foreach $activefw->get_whitelist;
}
@@ -163,19 +170,32 @@ sub get_selected_whitelist() {
sub whitelist {
my @addr = @_;
unblacklist(@addr);
- $activefw->whitelist($_) foreach @addr;
+ eval { $activefw->whitelist($_) foreach @addr };
+ if ($@) {
+ my $error = $@;
+ err_dialog(N("Error"), N("Unable to move in whitelist: %s", $error));
+ }
}
sub unwhitelist {
my @addr = @_;
- $activefw->unwhitelist($_) foreach @addr;
- #- delete from the list even if the above calls were unsuccessful
+ eval { $activefw->unwhitelist($_) foreach @addr };
+ if ($@) {
+ my $error = $@;
+ err_dialog(N("Error"), N("Unable to remove from whitelist: %s", $error));
+ }
list_remove_addr($whitelist->{data}, @addr);
}
sub init_lists() {
- init_blacklist();
- init_whitelist();
+ eval {
+ init_blacklist();
+ init_whitelist();
+ };
+ if ($@) {
+ my $error = $@;
+ err_dialog(N("Error"), N("Unable to contact the Active Firewall daemon: %s", $error));
+ }
}
sub clear_lists() {