From b559df204f4d99b9be8cb86686f844f33c687b19 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 19 Apr 2010 06:10:07 +0000 Subject: coded a tinydns datafile generator --- scripts/check_db_safety | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 scripts/check_db_safety (limited to 'scripts/check_db_safety') diff --git a/scripts/check_db_safety b/scripts/check_db_safety new file mode 100755 index 0000000..f3f3236 --- /dev/null +++ b/scripts/check_db_safety @@ -0,0 +1,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 -- cgit v1.2.3