changeset 1166:e991761c3da8 draft

check_db_safety: allow - in domain names and dns server names, escape - correctly for tr -d
author SeekingFor <nobody@nowhere>
date Wed, 16 Apr 2014 05:16:49 +0000
parents 6395f11f9649
children e16210381d6b
files scripts/check_db_safety
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/check_db_safety	Tue Mar 18 00:05:14 2014 +0100
+++ b/scripts/check_db_safety	Wed Apr 16 05:16:49 2014 +0000
@@ -1,17 +1,17 @@
 #!/bin/sh
-if [ "$(ls db/dom/ | tr -d 'a-z0-9\n-' | wc -c | tr -d ' \t')" != 0 ]; then
+if [ "$(ls db/dom/ | tr -d 'a-z0-9\n\-' | wc -c | tr -d ' \t')" != 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 | tr -d ' \t')" != 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-Fa-z0-9\n.-:' | wc -c | tr -d ' \t')" != 0 ]; then
+  if [ "$(ls $dom/ns/ | tr -d 'A-Fa-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
@@ -44,7 +44,7 @@
      exit 1
     fi
     for third in $second/* ; do
-     if [ "$(ls $third/ns/ | tr -d 'a-z0-9\n.-' | wc -c | tr -d ' \t')" != 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