[Dnsmasq-discuss] [PATCH] Fix compliance with RFC 1123

Kyle Mestery kmestery at cisco.com
Tue Jul 23 20:49:40 BST 2013


RFC 1123 permits hostnames to start with numbers. This patch
fixes this in dnsmasq so it follows the RFC and allows hostnames to start
with numbers.

Signed-off-by: Kyle Mestery <kmestery at cisco.com>
---
 src/util.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/util.c b/src/util.c
index af4031c..759099c 100644
--- a/src/util.c
+++ b/src/util.c
@@ -151,12 +151,12 @@ int legal_hostname(char *name)
     /* check for legal char a-z A-Z 0-9 - _ . */
     {
       if ((c >= 'A' && c <= 'Z') ||
-	  (c >= 'a' && c <= 'z'))
+	  (c >= 'a' && c <= 'z') ||
+	  (c >= '0' && c <= '9'))
 	continue;
 
       if (!first && 
-	  ((c >= '0' && c <= '9') ||
-	   c == '-' || c == '_'))
+	  (c == '-' || c == '_'))
 	continue;
 
       /* end of hostname part */
-- 
1.8.3.1




More information about the Dnsmasq-discuss mailing list