miniupnpd/testupnppermissions.sh: do not require bash or ksh anymore
This commit is contained in:
parent
ea90d39892
commit
1cdc352788
|
@ -1,31 +1,30 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
# $Id: testupnppermissions.sh,v 1.2 2015/09/22 15:12:14 nanard Exp $
|
||||
|
||||
# Array are not available with POSIX sh
|
||||
# bash / ksh
|
||||
|
||||
RULE[1]="allow 1-20000 11.12.13.14/22 1234"
|
||||
RULEA[1]="allow 1-20000 0b0c0d0e/fffffc00 1234-1234"
|
||||
RULEB[1]="allow 1-20000 11.12.13.14/255.255.252.0 1234-1234"
|
||||
RULE[2]="deny 55 21.22.23.24/17 555-559"
|
||||
RULEA[2]="deny 55-55 15161718/ffff8000 555-559"
|
||||
RULEB[2]="deny 55-55 21.22.23.24/255.255.128.0 555-559"
|
||||
RULE_1="allow 1-20000 11.12.13.14/22 1234"
|
||||
RULEA_1="allow 1-20000 0b0c0d0e/fffffc00 1234-1234"
|
||||
RULEB_1="allow 1-20000 11.12.13.14/255.255.252.0 1234-1234"
|
||||
RULE_2="deny 55 21.22.23.24/17 555-559"
|
||||
RULEA_2="deny 55-55 15161718/ffff8000 555-559"
|
||||
RULEB_2="deny 55-55 21.22.23.24/255.255.128.0 555-559"
|
||||
|
||||
i=1
|
||||
s=1
|
||||
./testupnppermissions "${RULE[@]}" | while read l;
|
||||
./testupnppermissions "$RULE_1" "$RULE_2" | while read l;
|
||||
do
|
||||
if [ -z "$l" ]; then i=$(($i+1)); s=1; else
|
||||
#echo "$i $s : checking '$l'"
|
||||
case $s in
|
||||
1)
|
||||
if [ "$i '${RULE[$i]}'" != "$l" ] ; then
|
||||
val=$(eval echo "\${RULE_$i}")
|
||||
if [ "$i '$val'" != "$l" ] ; then
|
||||
exit $s
|
||||
fi;;
|
||||
2)
|
||||
val=$(eval echo "\${RULEA_$i}")
|
||||
if [ "Permission read successfully" = "$l" ] ; then
|
||||
s=$(($s+1))
|
||||
elif [ "perm rule added : ${RULEA[$i]}" != "$l" ] ; then
|
||||
elif [ "perm rule added : $val" != "$l" ] ; then
|
||||
exit $s
|
||||
fi;;
|
||||
3)
|
||||
|
@ -33,7 +32,8 @@ do
|
|||
exit $s
|
||||
fi;;
|
||||
4)
|
||||
if [ "${RULEB[$i]}" != "$l" ] ; then
|
||||
val=$(eval echo "\${RULEB_$i}")
|
||||
if [ "$val" != "$l" ] ; then
|
||||
exit $s
|
||||
fi;;
|
||||
*)
|
||||
|
|
Loading…
Reference in New Issue