[Dnsmasq-discuss] spaces in hostnames

Simon Kelley simon at thekelleys.org.uk
Tue Feb 9 18:33:05 GMT 2016


On 07/02/16 02:04, Jim Alles wrote:
> Simon, Sir:
> 
> in 2007 @
> https://www.mail-archive.com/dnsmasq-discuss%40lists.thekelleys.org.uk/msg01532.html
> 
> you said:
> 
> "Hmm, an interesting can of worms. My first reaction to this was "it's
> 
> not a problem, spaces are not legal in hostnames and should never get
> there", but when I looked at the code, two things are apparent.
> 
> 1) Hostnames in --dhcp-host lines are not ever checked for legality:
> that's a bug. They are checked elsewhere (/etc/ethers, /etc/hosts, DHCP
> client supplied names....)
> 
> 2) The "is this hostname legal" checker actually allows spaces. This was
> a change made to allow SRV records for DNS-SD, which have to have
> spaces. The implications for the DHCP lease system were missed.
> 
> My inclination is to re-impose the ban on spaces on DHCP hostnames.
> Richard, would that cause you problems? Presumably you have at least one
> name with a space in it, is that "real" or from an all-possibilites test?
> 
> If spaces in hostnames are to be allowed, they should be escaped somehow.
> ​"
> 
> 
> May I ask ​what the resolution of this issue was? I see no reference
> in recent changelogs.
> 
> 
>  And  methinks the GUI of a router that I use should have an input
> validation to prevent spaces from being entered.
> 
> 

> My gratitude to you for being here!
> 
> 
> Jim Alles
> 


/* Hostnames have a more limited valid charset than domain names
   so check for legal char a-z A-Z 0-9 - _


It's all a very long time ago, but we ended up making the correct
distinction between _hostnames_ and _domain_names_

For dhcp-host, the check is for a legal hostname, which is

 a-z A-Z 0-9 - _

for names in /etc/hosts and friends, they're domain names, and anything
other then control characters are allowed. If dnsmasq is compiled with
the internationalised domain name support, then the check is done by the
IDN library, so it's whatever GNU libidn allows.



Cheers,

Simon.





More information about the Dnsmasq-discuss mailing list