bin/update: Check that the hostname is actually plausibly formed.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 6 Feb 2013 00:28:38 +0000 (00:28 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 6 Feb 2013 00:28:38 +0000 (00:28 +0000)
I'm going to assume that nsupdate or something will complain if the DNS
length limits or whatever are exceeded.

bin/update

index a9c2716..957df07 100755 (executable)
@@ -31,6 +31,13 @@ doneargs='case $# in 0) ;; *) fail_usage ;; esac'
 checkhost () {
   host=$1
 
+  case "$host" in
+    *..* | .* | *. | *[!-_.a-zA-Z0-9]*)
+      echo >&2 "$0: invalid hostname"
+      exit 2
+      ;;
+  esac
+
   matchp=nil
   for pat in $DYNDNS_HOST; do
     case "$host" in $pat) matchp=t ;; esac