[Freeipa-devel] [PATCH] 871 add hostname regex

Alexander Bokovoy abokovoy at redhat.com
Mon Sep 12 20:20:55 UTC 2011


On Mon, 12 Sep 2011, Rob Crittenden wrote:

> Alexander Bokovoy wrote:
> >On Mon, 12 Sep 2011, Rob Crittenden wrote:
> >
> >>Limit hostnames to letters, digits and - with a max length of 255
> >>
> >>      takes_params = (
> >>          Str('fqdn', validate_host,
> >>+            pattern='^[a-zA-Z0-9][a-zA-Z0-9-\.]{0,254}$',
> >>+            pattern_errmsg='may only include letters, numbers, and -',
> >>+            maxlength=255,
> >>              cli_name='hostname',
> >>              label=_('Host name'),
> >>              primary_key=True,
> >
> >What about IDN hosts? With this change we would require them to be
> >always in Punycode?
> >
> 
> Oh, hadn't considered that, I was just following the relevent RFCs.
> Is there a way we can easily support those as well?
IDN with Punycode-encoded names would already be supported by this 
validator. I was wondering about being able to enter those names as it 
is and if they fail the validator, convert them to IDN 
(xn--<Punycode> per name component) and use it forward.

However, we would need to make sure all of the comparisons would be 
done properly...

-- 
/ Alexander Bokovoy




More information about the Freeipa-devel mailing list