summaryrefslogtreecommitdiffstats
path: root/netconfig
diff options
context:
space:
mode:
Diffstat (limited to 'netconfig')
-rw-r--r--netconfig7
1 files changed, 5 insertions, 2 deletions
diff --git a/netconfig b/netconfig
index a33b85d..bb5a5ac 100644
--- a/netconfig
+++ b/netconfig
@@ -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