From d24d241e099ad37804b26063ffdcf77427e32a50 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Wed, 6 Feb 2013 00:28:38 +0000 Subject: [PATCH] bin/update: Check that the hostname is actually plausibly formed. Organization: Straylight/Edgeware From: Mark Wooding I'm going to assume that nsupdate or something will complain if the DNS length limits or whatever are exceeded. --- bin/update | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/update b/bin/update index a9c2716..957df07 100755 --- a/bin/update +++ b/bin/update @@ -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 -- [mdw]