[TYPO3-core] RFC: bug #7784: Check for mail configuration is wrong on Windows
Martin Kutschker
martin.kutschker-n0spam at no5pam-blackbox.net
Sun Mar 9 10:22:05 CET 2008
Dmitry Dulepov [typo3] schrieb:
> Hi!
>
> This is SVN patch request
>
> Type: bug
>
> Branch: 4.2, 4.1
>
> BT reference: http://bugs.typo3.org/view.php?id=7784
>
> Problem: mail check on Windows just says that Windows Sendmail is not
> checked. But there is no such thing on Windows at all. Instead SMTP and
> smtp_port should be checked.
>
> Solution: the attached patch takes care of the issue and additionally
> verifies that SMTP host exists in DNS. It also checks if it is localhost
> and server address is localhost (typical developer installation) and
> warns user about it.
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.
Masi
More information about the TYPO3-team-core
mailing list