3
# Copyright 2009 Canonical Ltd.
5
# This program is free software: you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License version 3,
7
# as published by the Free Software Foundation.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
source "$TESTPATH/../testlib.sh"
19
echo "Bug (Samba IPV4 tuple text wrong when IPV6 is enabled" >> $TESTTMP/result
20
sed -i 's/IPV6=.*/IPV6=yes/' $TESTPATH/etc/default/ufw
21
do_cmd "0" allow in on eth1 to any app Samba
22
grep -A2 "tuple" $TESTSTATE/user.rules >> $TESTTMP/result
23
grep -A2 "tuple" $TESTSTATE/user6.rules >> $TESTTMP/result
24
do_cmd "0" null delete allow in on eth1 to any app Samba
25
sed -i 's/IPV6=.*/IPV6=no/' $TESTPATH/etc/default/ufw
27
echo "Bug (inserted Samba rules out of order when IPV6 is enabled" >> $TESTTMP/result
28
sed -i 's/IPV6=.*/IPV6=yes/' $TESTPATH/etc/default/ufw
29
do_cmd "0" allow in on eth0
30
do_cmd "0" allow to 192.168.0.2
31
do_cmd "0" allow to 192.168.0.3
32
do_cmd "0" allow in on eth1
33
do_cmd "0" allow in on eth2
34
do_cmd "0" insert 8 deny to any app Bind9
35
grep "^-A .*user-input" $TESTSTATE/user.rules >> $TESTTMP/result
36
grep "^-A .*user-input" $TESTSTATE/user6.rules >> $TESTTMP/result
38
do_cmd "0" delete deny to any app Bind9
39
do_cmd "0" insert 8 deny to any app Samba
40
grep "^-A .*user-input" $TESTSTATE/user.rules >> $TESTTMP/result
41
grep "^-A .*user-input" $TESTSTATE/user6.rules >> $TESTTMP/result
43
# this insert should look the same as the above
44
do_cmd "0" delete deny to any app Samba
45
do_cmd "0" insert 5 deny to any app Bind9
46
grep "^-A .*user-input" $TESTSTATE/user.rules >> $TESTTMP/result
47
grep "^-A .*user-input" $TESTSTATE/user6.rules >> $TESTTMP/result
49
do_cmd "0" delete deny to any app Bind9
50
do_cmd "0" insert 5 deny to any app Samba
51
grep "^-A .*user-input" $TESTSTATE/user.rules >> $TESTTMP/result
52
grep "^-A .*user-input" $TESTSTATE/user6.rules >> $TESTTMP/result
54
do_cmd "0" delete allow in on eth0
55
do_cmd "0" delete allow to 192.168.0.2
56
do_cmd "0" delete allow to 192.168.0.3
57
do_cmd "0" delete allow in on eth1
58
do_cmd "0" delete allow in on eth2
59
do_cmd "0" delete deny to any app Samba
60
grep "^-A .*user-input" $TESTSTATE/user.rules >> $TESTTMP/result
61
grep "^-A .*user-input" $TESTSTATE/user6.rules >> $TESTTMP/result
62
sed -i 's/IPV6=.*/IPV6=no/' $TESTPATH/etc/default/ufw
64
echo "Bug #407810" >> $TESTTMP/result
65
cp "$TESTPATH/etc/ufw/applications.d/samba" "$TESTPATH/etc/ufw/applications.d/bug407810"
66
sed -i 's/Samba/bug407810/' "$TESTPATH/etc/ufw/applications.d/bug407810"
67
do_cmd "0" app info bug407810
68
do_cmd "0" null allow bug407810
69
grep "^-A .*user-input" $TESTSTATE/user.rules >> $TESTTMP/result
70
rm -f "$TESTPATH/etc/ufw/applications.d/bug407810"
71
do_cmd "0" null delete allow bug407810
72
grep "^-A .*user-input" $TESTSTATE/user.rules >> $TESTTMP/result