comparison scripts/check_db_safety @ 78:f37d8fca5548 draft

more OpenBSD fixes (again, thanks Quintum)
author Nick <nick@somerandomnick.ano>
date Wed, 21 Jul 2010 20:23:52 +0000
parents 6c1d4e261fdf
children c9a7817b5f1d
comparison
equal deleted inserted replaced
77:6c1d4e261fdf 78:f37d8fca5548
2 if [ "$(ls db/dom/ | tr -d 'a-z0-9\n-' | wc -c | tr -d ' \t')" != 0 ]; then 2 if [ "$(ls db/dom/ | tr -d 'a-z0-9\n-' | wc -c | tr -d ' \t')" != 0 ]; then
3 echo "There's a bad TLD. You probably don't want to run any shell scripts." >&2 3 echo "There's a bad TLD. You probably don't want to run any shell scripts." >&2
4 exit 1 4 exit 1
5 fi 5 fi
6 for tld in db/dom/* ; do 6 for tld in db/dom/* ; do
7 if [ "$(ls $tld/ | tr -d 'a-z0-9\n-' | wc -c)" != 0 ]; then 7 if [ "$(ls $tld/ | tr -d 'a-z0-9\n-' | wc -c | tr -d ' \t')" != 0 ]; then
8 tld="$(basename $tld)" 8 tld="$(basename $tld)"
9 echo "There's a bad domain under $tld." >&2 9 echo "There's a bad domain under $tld." >&2
10 echo "You probably don't want to run any shell scripts." >&2 10 echo "You probably don't want to run any shell scripts." >&2
11 exit 1 11 exit 1
12 fi 12 fi
13 for dom in $tld/* ; do 13 for dom in $tld/* ; do
14 if [ "$(ls $dom/ns/ | tr -d 'a-z0-9\n.-' | wc -c)" != 0 ]; then 14 if [ "$(ls $dom/ns/ | tr -d 'a-z0-9\n.-' | wc -c | tr -d ' \t')" != 0 ]; then
15 domain="$(basename $dom).$(basename $tld)" 15 domain="$(basename $dom).$(basename $tld)"
16 echo "There's a bad nameserver under $domain." >&2 16 echo "There's a bad nameserver under $domain." >&2
17 echo "You probably don't want to run any shell scripts." >&2 17 echo "You probably don't want to run any shell scripts." >&2
18 fi 18 fi
19 for ns in $dom/ns/* ; do 19 for ns in $dom/ns/* ; do
20 if [ "$(cat $ns | tr -d '0-9.\n' | wc -c)" != 0 ]; then 20 if [ "$(cat $ns | tr -d '0-9.\n' | wc -c | tr -d ' \t')" != 0 ]; then
21 domain="$(basename $dom).$(basename $tld)" 21 domain="$(basename $dom).$(basename $tld)"
22 nsname="$(basename $ns)" 22 nsname="$(basename $ns)"
23 echo "There's a bad nameserver IP under $domain, for" >&2 23 echo "There's a bad nameserver IP under $domain, for" >&2
24 echo " $nsname" >&2 24 echo " $nsname" >&2
25 echo "You probably don't want to run any shell scripts." >&2 25 echo "You probably don't want to run any shell scripts." >&2
26 fi 26 fi
27 done 27 done
28 done 28 done
29 done 29 done
30 if [ "$(ls db/ip/ | tr -d 'A-F0-9\n' | wc -c)" != 0 ]; then 30 if [ "$(ls db/ip/ | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then
31 echo "There's a bad first octet. You probably don't want to run any shell scripts." >&2 31 echo "There's a bad first octet. You probably don't want to run any shell scripts." >&2
32 exit 1 32 exit 1
33 for first in db/ip/* ; do 33 for first in db/ip/* ; do
34 if [ "$(ls $first/ | tr -d 'A-F0-9\n' | wc -c)" != 0 ]; then 34 if [ "$(ls $first/ | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then
35 echo "There's a bad second octet under $first." >&2 35 echo "There's a bad second octet under $first." >&2
36 echo "You probably don't want to run any shell scripts." >&2 36 echo "You probably don't want to run any shell scripts." >&2
37 exit 1 37 exit 1
38 for second in $first/* ; do 38 for second in $first/* ; do
39 if [ "$(ls $second/ | tr -d 'A-F0-9\n' | wc -c)" != 0 ]; then 39 if [ "$(ls $second/ | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then
40 echo "There's a bad third octet under $second." >&2 40 echo "There's a bad third octet under $second." >&2
41 echo "You probably don't want to run any shell scripts." >&2 41 echo "You probably don't want to run any shell scripts." >&2
42 exit 1 42 exit 1
43 fi 43 fi
44 for third in $second/* ; do 44 for third in $second/* ; do
45 if [ "$(ls $third/ns/ | tr -d 'a-z0-9\n.-' | wc -c)" != 0 ]; then 45 if [ "$(ls $third/ns/ | tr -d 'a-z0-9\n.-' | wc -c | tr -d ' \t')" != 0 ]; then
46 ip="$(basename $first).$(basename $second).$(basename $third).0/24" 46 ip="$(basename $first).$(basename $second).$(basename $third).0/24"
47 echo "There's a bad nameserver under $ip." >&2 47 echo "There's a bad nameserver under $ip." >&2
48 echo "You probably don't want to run any shell scripts." >&2 48 echo "You probably don't want to run any shell scripts." >&2
49 fi 49 fi
50 for ns in $third/ns/* ; do 50 for ns in $third/ns/* ; do
51 if [ "$(cat $ns | tr -d '0-9.\n' | wc -c)" != 0 ]; then 51 if [ "$(cat $ns | tr -d '0-9.\n' | wc -c | tr -d ' \t')" != 0 ]; then
52 ip="$(basename $first).$(basename $second).$(basename $third).0/24" 52 ip="$(basename $first).$(basename $second).$(basename $third).0/24"
53 nsname="$(basename $ns)" 53 nsname="$(basename $ns)"
54 echo "There's a bad nameserver IP under $ip, for" >&2 54 echo "There's a bad nameserver IP under $ip, for" >&2
55 echo " $nsname" >&2 55 echo " $nsname" >&2
56 echo "You probably don't want to run any shell scripts." >&2 56 echo "You probably don't want to run any shell scripts." >&2