changeset 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 9a0e9ee425cc
files scripts/check_db_safety
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/check_db_safety	Wed Jul 21 19:53:17 2010 +0000
+++ b/scripts/check_db_safety	Wed Jul 21 20:23:52 2010 +0000
@@ -4,20 +4,20 @@
  exit 1
 fi
 for tld in db/dom/* ; do
- if [ "$(ls $tld/ | tr -d 'a-z0-9\n-' | wc -c)" != 0 ]; then
+ if [ "$(ls $tld/ | tr -d 'a-z0-9\n-' | wc -c | tr -d ' \t')" != 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
+  if [ "$(ls $dom/ns/ | tr -d 'a-z0-9\n.-' | wc -c | tr -d ' \t')" != 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
+   if [ "$(cat $ns | tr -d '0-9.\n' | wc -c | tr -d ' \t')" != 0 ]; then
     domain="$(basename $dom).$(basename $tld)"
     nsname="$(basename $ns)"
     echo "There's a bad nameserver IP under $domain, for" >&2
@@ -27,28 +27,28 @@
   done
  done
 done
-if [ "$(ls db/ip/ | tr -d 'A-F0-9\n' | wc -c)" != 0 ]; then
+if [ "$(ls db/ip/ | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then
  echo "There's a bad first octet.  You probably don't want to run any shell scripts." >&2
  exit 1
  for first in db/ip/* ; do
-  if [ "$(ls $first/ | tr -d 'A-F0-9\n' | wc -c)" != 0 ]; then
+  if [ "$(ls $first/ | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then
    echo "There's a bad second octet under $first." >&2
    echo "You probably don't want to run any shell scripts." >&2
    exit 1
    for second in $first/* ; do
-    if [ "$(ls $second/ | tr -d 'A-F0-9\n' | wc -c)" != 0 ]; then
+    if [ "$(ls $second/ | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then
      echo "There's a bad third octet under $second." >&2
      echo "You probably don't want to run any shell scripts." >&2
      exit 1
     fi
     for third in $second/* ; do
-     if [ "$(ls $third/ns/ | tr -d 'a-z0-9\n.-' | wc -c)" != 0 ]; then
+     if [ "$(ls $third/ns/ | tr -d 'a-z0-9\n.-' | wc -c | tr -d ' \t')" != 0 ]; then
       ip="$(basename $first).$(basename $second).$(basename $third).0/24"
       echo "There's a bad nameserver under $ip." >&2
       echo "You probably don't want to run any shell scripts." >&2
      fi
      for ns in $third/ns/* ; do
-      if [ "$(cat $ns | tr -d '0-9.\n' | wc -c)" != 0 ]; then
+      if [ "$(cat $ns | tr -d '0-9.\n' | wc -c | tr -d ' \t')" != 0 ]; then
        ip="$(basename $first).$(basename $second).$(basename $third).0/24"
        nsname="$(basename $ns)"
        echo "There's a bad nameserver IP under $ip, for" >&2