diff options
-rwxr-xr-x | bin/drakguard | 12 |
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); } |