Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: smtpd: spell HOST_NAME_MAX differently (for -portable)
To:
Florian Obser <florian@openbsd.org>
Cc:
tech@openbsd.org, gilles@poolp.org
Date:
Tue, 20 Aug 2024 15:36:45 +0200

Download raw body.

Thread
On 2024/08/20 14:49:06 +0200, Florian Obser <florian@openbsd.org> wrote:
> On 2024-08-20 12:40 +02, Omar Polo <op@omarpolo.com> wrote:
> > in -portable land there's an issue on glibc-based systems because
> > HOST_NAME_MAX is set at 64.  We end up truncating longer names and this
> > makes checks like fcrdns fails.
> >
> > In the spirit of reducing the number of portable only changes to carry,
> > would something like this be acceptable for base?  An alternative would
> > be to use _POSIX_HOST_NAME_MAX instead.
> >
> > The diff is mostly by Romain Petit via[0] adapted for base.
> > [0]: <https://github.com/OpenSMTPD/OpenSMTPD/pull/1260>
> >
> > Thoughts?
> 
> I think they should fix their libc.

I think so too

> posix has this to say:
> 
> {HOST_NAME_MAX}
>     Maximum length of a host name (not including the terminating null) as returned from the gethostname() function.
>     Minimum Acceptable Value: {_POSIX_HOST_NAME_MAX}
> 
> {_POSIX_HOST_NAME_MAX}
>     Maximum length of a host name (not including the terminating null) as returned from the gethostname() function.
>     Value: 255

Yep, but I'm not sure they'll fix their libc anytime soon, so we'll have
to cope in -portable one way or another. :/

Their gethostname(2) manpage in the VERSIONS section explains that
HOST_NAME_MAX has been 64 since linux 1.0 (and before was even lower) so
I guess they know and won't do anything.

See the beautiful "This limit is imposed by the Linux kernel"
<https://marc.info/?l=glibc-alpha&m=119206565522048&w=2>

(and fwiw musl does the right thing.)