summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-03-27 00:46:53 +0000
committerOlivier Blin <oblin@mandriva.com>2008-03-27 00:46:53 +0000
commitbf044543c197e277d131b5b3bd46e8690e6cfbbf (patch)
tree4194da684373d16d0d357268f0c334c45abc7991
parentf20b9ade0d8d4f992940941d3fed732770d97c50 (diff)
downloaddrakguard-bf044543c197e277d131b5b3bd46e8690e6cfbbf.tar
drakguard-bf044543c197e277d131b5b3bd46e8690e6cfbbf.tar.gz
drakguard-bf044543c197e277d131b5b3bd46e8690e6cfbbf.tar.bz2
drakguard-bf044543c197e277d131b5b3bd46e8690e6cfbbf.tar.xz
drakguard-bf044543c197e277d131b5b3bd46e8690e6cfbbf.zip
write whitelist/blacklist files
-rwxr-xr-xbin/drakguard16
1 files changed, 10 insertions, 6 deletions
diff --git a/bin/drakguard b/bin/drakguard
index 847a8d8..89db0fc 100755
--- a/bin/drakguard
+++ b/bin/drakguard
@@ -52,12 +52,14 @@ my @url_lists = (
list_title => N("Forbidden addresses"),
remove_text => N("Remove from blacklist"),
file => $blacklist_url_file,
+ apply => \&apply_blacklist,
},
{
tab_title => N("Whitelist"),
list_title => N("Allowed addresses"),
remove_text => N("Remove from whitelist"),
file => $whitelist_url_file,
+ apply => \&apply_whitelist,
}
);
@@ -203,8 +205,7 @@ sub save() {
$in->do_pkgs->ensure_is_installed('dansguardian', '/usr/sbin/dansguardian')
or quit_gui();
- apply_blacklist();
- apply_whitelist();
+ $_->{apply}(map { $_->[0] } @{$_->{list}{data}}) foreach @url_lists;
write_dansguardian();
enable_transparent_proxy($proxy_port);
services::set_status($_, $enable) foreach qw(squid dansguardian);
@@ -260,8 +261,6 @@ sub include_guardian_file {
if (!member($to_add, @all)) {
output_p($guardian_file, @all, $to_add);
}
- output_p($external_file, if_($o_category, qq(#listcategory: "$o_category"\n)))
- unless -f $external_file;
}
sub read_url_list {
@@ -269,13 +268,18 @@ sub read_url_list {
grep { $_ && !/^\s*#/ } chomp_(cat_($file));
}
-sub apply_blacklist() {
+sub apply_blacklist {
+ my @addr = @_;
my $blacklist_top = "/etc/dansguardian/lists/bannedsitelist";
my $blacklist_category = "blocked by Mandriva parental control tool";
+ output_p($blacklist_url_file, map { $_ . "\n" }
+ qq(#listcategory: "$blacklist_category"), @addr);
include_guardian_file($blacklist_top, $blacklist_url_file, $blacklist_category);
}
-sub apply_whitelist() {
+sub apply_whitelist {
+ my @addr = @_;
my $whitelist_top = "/etc/dansguardian/lists/exceptionurllist";
+ output_p($whitelist_url_file, map { $_ . "\n" } @addr);
include_guardian_file($whitelist_top, $whitelist_url_file);
}