diff options
-rw-r--r-- | netconfig | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -492,8 +492,11 @@ EOF DOMAIN="`cat $TMP/SeTdom`" rm -f $TMP/SeTdom $TMP/tempmsg # These regexes doon't catch everything, just basic syntax mistakes. - if [ "$DOMAIN" = "" ] || [[ ! "$DOMAIN" =~ ^([[:alnum:]]+[-.]*[[:alnum:]]+)+$ ]] || \ - [[ "${DOMAIN:0:1}" =~ ^[.-]$ ]] || [[ "${DOMAIN: -1:1}" == ^[.-]$ ]]; then + DN="${DOMAIN%.*}" + TLD="${DOMAIN##*.}" + if [ -z "$DOMAIN" ] || [ -z "$TLD" ] || [ -z "$DN" ] || [[ ! "$DOMAIN" =~ ^[^.-][[:alnum:].-]+[^.-]$ ]] || \ + [[ ! "$DN" =~ ^[^.-][[:alnum:].-]+[^.-]$ ]] || [[ "$DN" =~ \.\. ]] || [[ "$DN" =~ -- ]] || \ + [[ ! "$TLD" =~ ^[^-][[:alnum:]-]+[^-]$ ]]; then dialog --title "DOMAINNAME" --ok-button "Back" --msgbox \ "That doesn't appear to be a valid domain name.\n Domain names can only contain letters and numbers, hyphens |