diff options
author | Olivier Blin <oblin@mandriva.com> | 2008-08-13 10:34:24 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2008-08-13 10:34:24 +0000 |
commit | 69abb009984591a846641fb5120a1340f7fc9357 (patch) | |
tree | 62db3e6bd8c1987da982f64a7f7a1206c4184392 | |
parent | 95c6b8adc555f31ce62ba3f5151c2ad406598a29 (diff) | |
download | drakx-net-69abb009984591a846641fb5120a1340f7fc9357.tar drakx-net-69abb009984591a846641fb5120a1340f7fc9357.tar.gz drakx-net-69abb009984591a846641fb5120a1340f7fc9357.tar.bz2 drakx-net-69abb009984591a846641fb5120a1340f7fc9357.tar.xz drakx-net-69abb009984591a846641fb5120a1340f7fc9357.zip |
move set_in_file from network::drakfirewall to network::shorewall (to be used by drakguard)
-rw-r--r-- | lib/network/drakfirewall.pm | 11 | ||||
-rw-r--r-- | lib/network/shorewall.pm | 8 |
2 files changed, 10 insertions, 9 deletions
diff --git a/lib/network/drakfirewall.pm b/lib/network/drakfirewall.pm index 8472b3f..c471e88 100644 --- a/lib/network/drakfirewall.pm +++ b/lib/network/drakfirewall.pm @@ -236,18 +236,11 @@ sub set_ifw { ); } - my $set_in_file = sub { - my ($file, @list) = @_; - substInFile { - foreach my $l (@list) { s|^$l\n|| } - $_ .= join("\n", @list) . "\n" if eof && $enabled; - } "$::prefix/etc/shorewall/$file"; - }; substInFile { undef $_ if $_ eq "INCLUDE /etc/ifw/rules", "iptables -I INPUT 2 -j Ifw"; } "$::prefix/etc/shorewall/start"; - $set_in_file->('start', "INCLUDE /etc/ifw/start", "INCLUDE /etc/ifw/rules", "iptables -I INPUT 1 -j Ifw"); - $set_in_file->('stop', "iptables -D INPUT -j Ifw", "INCLUDE /etc/ifw/stop"); + network::shorewall::set_in_file('start', $enabled, "INCLUDE /etc/ifw/start", "INCLUDE /etc/ifw/rules", "iptables -I INPUT 1 -j Ifw"); + network::shorewall::set_in_file('stop', $enabled, "iptables -D INPUT -j Ifw", "INCLUDE /etc/ifw/stop"); } sub choose_watched_services { diff --git a/lib/network/shorewall.pm b/lib/network/shorewall.pm index 0361eb8..a93af5d 100644 --- a/lib/network/shorewall.pm +++ b/lib/network/shorewall.pm @@ -36,6 +36,14 @@ sub get_config_file { map { [ split ' ' ] } grep { !/^#/ } cat_("$::prefix${shorewall_root}/$file"); } +sub set_in_file { + my ($file, $enabled, @list) = @_; + substInFile { + foreach my $l (@list) { s|^$l\n|| } + $_ .= join("\n", @list) . "\n" if eof && $enabled; + } "$::prefix/etc/shorewall/$file"; +} + sub dev_to_shorewall { my ($dev) = @_; $dev =~ /^ippp/ && "ippp+" || |