From: Axel Gembe Date: Mon, 11 Aug 2014 04:23:58 +0000 (+0800) Subject: general-functions.pl: validdomainname misinterprets RFC1035 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8ed77b039fd0373fdc07ec79877caf34b8264cd2;p=people%2Fms%2Fipfire-2.x.git general-functions.pl: validdomainname misinterprets RFC1035 The function validdomainname checks that each part of a domain name is at least 2 characters in length, but RFC1035 only makes a restriction on a "label" being at most 63 characters in length. This change allows reverse DNS zones like 2.168.192.in-addr.arpa to be added to the DNS forward configuration, which was incorrectly prevented before. Signed-off-by: Axel Gembe --- diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 66286ed1e0..8ed87fc80e 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -627,9 +627,8 @@ sub validdomainname my @parts = split (/\./, $domainname); # Split hostname at the '.' foreach $part (@parts) { - # Each part should be at least two characters in length - # but no more than 63 characters - if (length ($part) < 2 || length ($part) > 63) { + # Each part should be no more than 63 characters in length + if (length ($part) < 1 || length ($part) > 63) { return 0;} # Only valid characters are a-z, A-Z, 0-9 and - if ($part !~ /^[a-zA-Z0-9-]*$/) {