summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-12-17 09:21:05 +0100
committerAleksander Machniak <alec@alec.pl>2013-12-17 09:21:05 +0100
commita520f331c16fc703cc92d5b9853fb91805f82305 (patch)
treef2d28e85b2bfa09a1080577e084c8c50b5c58ae8 /program/steps/mail
parent7b1969ad609a0fe94534bc33453bd20f5796e2a6 (diff)
Fix handling of X-Forwarded-For header with multiple addresses (#1489481)
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/sendmail.inc7
1 files changed, 4 insertions, 3 deletions
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index fe966a4d4..f26034fa4 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -345,9 +345,10 @@ if ($CONFIG['http_received_header'])
$nldlm = "\r\n\t";
// FROM/VIA
$http_header = 'from ';
- if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
- $host = $_SERVER['HTTP_X_FORWARDED_FOR'];
- $hostname = gethostbyaddr($host);
+ if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
+ $hosts = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'], 2);
+ $hostname = gethostbyaddr($hosts[0]);
+
if ($CONFIG['http_received_header_encrypt']) {
$http_header .= rcmail_encrypt_header($hostname);
if ($host != $hostname)