From 67437a202498f8ae9fd3a2a9828142390ddd46e1 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen.hemminger@vyatta.com>
Date: Mon, 3 Mar 2008 13:18:16 -0800
Subject: don't allow illegal hostnames

Be more restrictive on hostnames to conform with RFC 952.
Host name can't begin or end with a minus sign.
---
 templates/system/host-name/node.def | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'templates/system/host-name/node.def')

diff --git a/templates/system/host-name/node.def b/templates/system/host-name/node.def
index 54ed9fef..437a939d 100644
--- a/templates/system/host-name/node.def
+++ b/templates/system/host-name/node.def
@@ -1,7 +1,7 @@
 type: txt
 help: Configure system host name
 default: "vyatta"
-syntax:expression: pattern $VAR(@) "^[-a-zA-Z0-9.]+$"
+syntax:expression: pattern $VAR(@) "^[[:alpha:]][-.[:alpha:]]*[[:alpha:]]$"
                    ; "invalid host name $VAR(@)"
 update: sudo sh -c " \
   hostname '$VAR(@)'
-- 
cgit v1.2.3


From 6fb63ac4b13a625093646476646173559e4fea8b Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen.hemminger@vyatta.com>
Date: Mon, 3 Mar 2008 13:25:56 -0800
Subject: allow numbers in hostname

Last commit blocked names like "test1", proper expression from
RFC 952 is:
      <hname> ::= <name>*["."<name>]
      <name>  ::= <let>[*[<let-or-digit-or-hyphen>]<let-or-digit>]
---
 templates/system/host-name/node.def | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'templates/system/host-name/node.def')

diff --git a/templates/system/host-name/node.def b/templates/system/host-name/node.def
index 437a939d..1aba2174 100644
--- a/templates/system/host-name/node.def
+++ b/templates/system/host-name/node.def
@@ -1,7 +1,7 @@
 type: txt
 help: Configure system host name
 default: "vyatta"
-syntax:expression: pattern $VAR(@) "^[[:alpha:]][-.[:alpha:]]*[[:alpha:]]$"
+syntax:expression: pattern $VAR(@) "^[[:alpha:]][-.[:alnum:]]*[[:alnum:]]$"
                    ; "invalid host name $VAR(@)"
 update: sudo sh -c " \
   hostname '$VAR(@)'
-- 
cgit v1.2.3

