Re: [INTERNALS-WIN] mail() sending local hostname instead of fully-qualified hostname as HELO

[email protected] (Kalle Sommer Nielsen)
Newsgroups php.internals.win
Message-ID <[email protected]>
Hi Rick

2009/6/25 Rick Yorgason <[email protected]>:
>* If you change the code to use inet_addr, beware that it's not IPv6 aware; you'll need to use inet_pton[4] for > IPv6 code, and unfortunately that function is only supported by Vista and Win2k8.

We have our own inet_ntop/inet_pton implementations if the compiling
OS lacks of it, see php-src/win32/inet.c

> If you still wanted to be extra-safe, it would probably be better to return
> the IP address in square-brackets, since that's a valid HELO value[5].

Thanks for the information, I revised the patch yet another time, this
time I've removed the ip block, and if an ip should be detected it
will put them in brackets as per your link.

The ip detection is done by this, but im sure you probably could use
the inet_ntop/pton functions to validate an ip better:
isdigit(ent->h_name[0]) || strchr(ent->h_name, ':')

so it both check if the first character is numeric or if the hostname
contains a colon as it will always be present in an ipv6 address. I
however don't know if the hostname may have a numeric first character,
but if that should be the case then, .. :)

The updated patch is available at:
http://pastie.org/525049

But whether to, or not to include the ip stuff, then I think we should
keep it like this (with brackets).

-- 
regrads,

Kalle Sommer Nielsen
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.