Allow hostnames to start with a number.

This commit is contained in:
Kyle Mestery
2013-07-24 13:11:58 +01:00
committed by Simon Kelley
parent b4b9308079
commit d859ca2f9b
2 changed files with 7 additions and 5 deletions

View File

@@ -60,6 +60,9 @@ version 2.67
AudioCodes Voice Gateways doing streaming writes to flash. AudioCodes Voice Gateways doing streaming writes to flash.
Thanks to Damian Kaczkowski for spotting the problem. Thanks to Damian Kaczkowski for spotting the problem.
Allow hostnames to start with a number, as allowed in
RFC-1123. Thanks to Kyle Mestery for the patch.
version 2.66 version 2.66
Add the ability to act as an authoritative DNS Add the ability to act as an authoritative DNS

View File

@@ -151,14 +151,13 @@ int legal_hostname(char *name)
/* check for legal char a-z A-Z 0-9 - _ . */ /* check for legal char a-z A-Z 0-9 - _ . */
{ {
if ((c >= 'A' && c <= 'Z') || if ((c >= 'A' && c <= 'Z') ||
(c >= 'a' && c <= 'z')) (c >= 'a' && c <= 'z') ||
(c >= '0' && c <= '9'))
continue; continue;
if (!first && if (!first && (c == '-' || c == '_'))
((c >= '0' && c <= '9') ||
c == '-' || c == '_'))
continue; continue;
/* end of hostname part */ /* end of hostname part */
if (c == '.') if (c == '.')
return 1; return 1;