diff options
author | Olivier Blin <oblin@mandriva.com> | 2008-04-03 08:37:58 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2008-04-03 08:37:58 +0000 |
commit | b7aea39db60265bdbcb6ab1c0bf666ec3e61ea3e (patch) | |
tree | c9c84d9692338c6dc77f2070b8bbeff1b792e052 | |
parent | b5771d063265a3601610329d0d5bd31267d5de88 (diff) | |
download | drakguard-b7aea39db60265bdbcb6ab1c0bf666ec3e61ea3e.tar drakguard-b7aea39db60265bdbcb6ab1c0bf666ec3e61ea3e.tar.gz drakguard-b7aea39db60265bdbcb6ab1c0bf666ec3e61ea3e.tar.bz2 drakguard-b7aea39db60265bdbcb6ab1c0bf666ec3e61ea3e.tar.xz drakguard-b7aea39db60265bdbcb6ab1c0bf666ec3e61ea3e.zip |
add list_get_entries helper
-rwxr-xr-x | bin/drakguard | 9 |
1 files changed, 7 insertions, 2 deletions
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); |