summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-10-27 10:03:55 +0000
committeralecpl <alec@alec.pl>2008-10-27 10:03:55 +0000
commit11b1b16b2fa855eab6c03b69c41a38a423332a27 (patch)
tree36f1c482abfe4c29482b13d6ed125268c7d52007
parent139f99d413f119314abb6320d56eceb9813a1578 (diff)
#1485518: validate SERVER_NAME for smtp_helo_host setting
-rw-r--r--program/include/rcube_smtp.inc9
1 files changed, 7 insertions, 2 deletions
diff --git a/program/include/rcube_smtp.inc b/program/include/rcube_smtp.inc
index 4e5449075..fd1dff3f0 100644
--- a/program/include/rcube_smtp.inc
+++ b/program/include/rcube_smtp.inc
@@ -76,14 +76,19 @@ function smtp_mail($from, $recipients, &$headers, &$body, &$response)
// create Net_SMTP object and connect to server
if (!is_object($SMTP_CONN))
{
- $helo_host = empty($CONFIG['smtp_helo_host']) ? (empty($_SERVER['SERVER_NAME']) ? 'localhost' : $_SERVER['SERVER_NAME']) : $CONFIG['smtp_helo_host'];
+ if (!empty($CONFIG['smtp_helo_host']))
+ $helo_host = $CONFIG['smtp_helo_host'];
+ else if (!empty($_SERVER['SERVER_NAME']))
+ $helo_host = preg_replace('/:\d+$/', '', $_SERVER['SERVER_NAME']);
+ else
+ $helo_host = 'localhost';
+
$SMTP_CONN = new Net_SMTP($smtp_host, $smtp_port, $helo_host);
// set debugging
if ($CONFIG['debug_level'] & 8)
$SMTP_CONN->setDebug(TRUE);
-
// try to connect to server and exit on failure
$result = $SMTP_CONN->connect($smtp_timeout);
if (PEAR::isError($result))