summaryrefslogtreecommitdiff
path: root/scripts/check_db_safety
blob: f3f323690ca2c76d82c85ff08fdc4ab06f62d6d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
if [ "$(ls db/dom/ | tr -d 'a-z0-9\n-' | wc -c)" != 0 ]; then
 echo "There's a bad TLD.  You probably don't want to run any shell scripts." >&2
 exit 1
fi
for tld in db/dom/* ; do
 if [ "$(ls $tld/ | tr -d 'a-z0-9\n-' | wc -c)" != 0 ]; then
  tld="$(basename $tld)"
  echo "There's a bad domain under $tld." >&2
  echo "You probably don't want to run any shell scripts." >&2
  exit 1
 fi
 for dom in $tld/* ; do
  if [ "$(ls $dom/ns/ | tr -d 'a-z0-9\n.-' | wc -c)" != 0 ]; then
   domain="$(basename $dom).$(basename $tld)"
   echo "There's a bad nameserver under $domain." >&2
   echo "You probably don't want to run any shell scripts." >&2
  fi
  for ns in $dom/ns/* ; do
   if [ "$(cat $ns | tr -d '0-9.\n' | wc -c)" != 0 ]; then
    domain="$(basename $dom).$(basename $tld)"
    nsname="$(basename $ns)"
    echo "There's a bad nameserver IP under $domain, for" >&2
    echo " $nsname" >&2
    echo "You probably don't want to run any shell scripts." >&2
   fi
  done
 done
done