From b7aea39db60265bdbcb6ab1c0bf666ec3e61ea3e Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Thu, 3 Apr 2008 08:37:58 +0000 Subject: add list_get_entries helper --- bin/drakguard | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/drakguard b/bin/drakguard index b28fd91..08f9bbc 100755 --- a/bin/drakguard +++ b/bin/drakguard @@ -220,6 +220,11 @@ sub list_remove_selected { list_remove_entry($list, list_get_selected($list)); } +sub list_get_entries { + my ($list) = @_; + map { $_->[0] } @{$list->{data}}; +} + sub add_user { list_add_entry($users_list, list_get_selected($allusers_list)); } @@ -245,7 +250,7 @@ sub save() { $in->do_pkgs->ensure_are_installed([ qw(shorewall squid dansguardian) ]) or quit_gui(1); - $_->{apply}(map { $_->[0] } @{$_->{list}{data}}) foreach @url_lists; + $_->{apply}(list_get_entries($_->{list})) foreach @url_lists; write_dansguardian(); enable_transparent_proxy($proxy_port); #- reload shorewall config if it has just been installed @@ -255,7 +260,7 @@ sub save() { if ($shorewall) { $shorewall->{disabled} = 0 if $enable; - @{$shorewall->{accept_local_users}{http}} = if_($enable, uniq($proxy_user,map { $_->[0] } @{$users_list->{data}})); + @{$shorewall->{accept_local_users}{http}} = if_($enable, uniq($proxy_user, list_get_entries($users_list))); @{$shorewall->{accept_local_users}{$proxy_port}} = if_($enable, $guardian_user); network::shorewall::set_redirected_ports($shorewall, 'tcp', $guardian_port, if_($enable, 'http', $proxy_port)); network::shorewall::write($shorewall, $in); -- cgit v1.2.1