[TYPO3-core] RFC: bug #7784: Check for mail configuration is wrong on Windows
Dmitry Dulepov [typo3]
dmitry at typo3.org
Mon Mar 17 16:09:23 CET 2008
Hi!
Martin Kutschker wrote:
> I think this check is not correct (only from reading):
>
> if (!$smtp || $smtp == ($smtp_addr = @gethostbyname($smtp)) ||
>
> You assume that the user enters a host name, but he could in fact also
> set an IP address.
>
> Furthermore $smtp_addr is set as side-effect, but is later on used in
> the else-clause of the same if-statement. I didn't followed all possible
> threads through the condition logic, but for readability I suggest that
> $smtp_addr (and a new $smtp_name) are not set within the condition.
>
> The localhost check will fail on machine with an IPv6 interface. AT
> least I think so, I have not seen such a machine in real life.
>
> My suggestion (untested):
>
> $smtp = ini_get('SMTP');
> if ($smtp) {
> if (t3lib_div::validIP($smtp)) {
> $smpt_addr = $smtp;
> } else {
> $smpt_name = @gethostbyname($smtp);
> if ($smtp_name == $smtp) {
> $smtp_name = '';
> }
> }
> }
>
> Now either $smtp_addr or $smtp_name is set.
See the attached patch. Similar to your solution. Made almost immediately after you posted your message but did not have time to post it...
--
Dmitry Dulepov
TYPO3 core team
Web: http://typo3bloke.net/
Skype: callto:liels_bugs
"Nothing is impossible. There are only limits to our knowledge"
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 7784_v2.diff
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080317/4094cdd0/attachment.txt
More information about the TYPO3-team-core
mailing list