summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-03-26 17:57:34 +0000
committerOlivier Blin <oblin@mandriva.com>2008-03-26 17:57:34 +0000
commit9b71c00515330393003964728cc754b96e8153de (patch)
treee63c89cc186619cd32dcc9438ece97e00313814f /bin
parentbf6a0a31b4a357136ff0784dd77c6c42c6635cb0 (diff)
downloaddrakguard-9b71c00515330393003964728cc754b96e8153de.tar
drakguard-9b71c00515330393003964728cc754b96e8153de.tar.gz
drakguard-9b71c00515330393003964728cc754b96e8153de.tar.bz2
drakguard-9b71c00515330393003964728cc754b96e8153de.tar.xz
drakguard-9b71c00515330393003964728cc754b96e8153de.zip
read URL whitelist and blacklist
Diffstat (limited to 'bin')
-rwxr-xr-xbin/drakguard12
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/drakguard b/bin/drakguard
index 91de07a..f1dde04 100755
--- a/bin/drakguard
+++ b/bin/drakguard
@@ -33,6 +33,8 @@ $::main_window = $w->{real_window};
my $in = interactive->vnew('su');
my $shorewall = network::shorewall::read();
+my $blacklist_url_file = "/etc/dansguardian/lists/blacklists/drakguard/urls";
+my $whitelist_url_file = "/etc/dansguardian/lists/whitelists/drakguard/urls";
my $allusers_list = Gtk2::SimpleList->new(N("All users") => 'text');
$allusers_list->get_selection->set_mode('multiple');
@@ -43,8 +45,11 @@ $users_list->get_selection->set_mode('multiple');
my $whitelist = Gtk2::SimpleList->new(N("Allowed addresses") => 'text');
$whitelist->get_selection->set_mode('multiple');
+@{$whitelist->{data}} = read_url_list($whitelist_url_file);
+
my $blacklist = Gtk2::SimpleList->new(N("Forbidden addresses") => 'text');
$blacklist->get_selection->set_mode('multiple');
+@{$blacklist->{data}} = read_url_list($blacklist_url_file);
my ($enable, $level, $time_control, $allow_time_change);
load();
@@ -252,15 +257,18 @@ sub include_guardian_file {
unless -f $external_file;
}
+sub read_url_list {
+ my ($file) = @_;
+ grep { $_ && !/^\s*#/ } chomp_(cat_($file));
+}
+
sub apply_blacklist() {
my $blacklist_top = "/etc/dansguardian/lists/bannedsitelist";
- my $blacklist_url_file = "/etc/dansguardian/lists/blacklists/drakguard/urls";
my $blacklist_category = "blocked by Mandriva parental control tool";
include_guardian_file($blacklist_top, $blacklist_url_file, $blacklist_category);
}
sub apply_whitelist() {
my $whitelist_top = "/etc/dansguardian/lists/exceptionurllist";
- my $whitelist_url_file = "/etc/dansguardian/lists/whitelists/drakguard/urls";
include_guardian_file($whitelist_top, $whitelist_url_file);
}