summaryrefslogtreecommitdiff
path: root/scripts/check_db_safety
diff options
context:
space:
mode:
authorNick <nick@somerandomnick.ano>2010-04-19 06:10:07 +0000
committerNick <nick@somerandomnick.ano>2010-04-19 06:10:07 +0000
commitb559df204f4d99b9be8cb86686f844f33c687b19 (patch)
tree0ddeb523898731e50b1ee0bfc6a93a6a7400844a /scripts/check_db_safety
parentb036de602aa1ec18e7a4da07f4a7a76932441f7c (diff)
downloadresdb-b559df204f4d99b9be8cb86686f844f33c687b19.tar.gz
resdb-b559df204f4d99b9be8cb86686f844f33c687b19.zip
coded a tinydns datafile generator
Diffstat (limited to 'scripts/check_db_safety')
-rwxr-xr-xscripts/check_db_safety29
1 files changed, 29 insertions, 0 deletions
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