Re: [INTERNALS-WIN] mail() sending local hostname instead of fully-qualified hostname as HELO
| From: | Kalle Sommer Nielsen | Date: | Fri, 26 Jun 2009 02:56:44 +0000 |
| Subject: | Re: [INTERNALS-WIN] mail() sending local hostname instead of fully-qualified hostname as HELO | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals.win |
| Request: | Send a blank email to internals-win+get-521@lists.php.net to get a copy of this message | ||
Hi Rick
2009/6/25 Rick Yorgason <rick@longbowgames.com>:
>* 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
kalle@php.net