From 9949206dba7cb11642f9c9380a2fafb9999d39e7 Mon Sep 17 00:00:00 2001 From: gustavf Date: Thu, 6 Jul 2000 10:35:59 +0000 Subject: [PATCH] Added proxying information to the Received: header if the user comes through a HTTP-prxy that sets either HTTP_VIA or HTTP_X_FORWARDED_FOR. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@597 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/smtp.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/functions/smtp.php b/functions/smtp.php index 8b81c90c..b7ececf2 100644 --- a/functions/smtp.php +++ b/functions/smtp.php @@ -109,7 +109,7 @@ function write822Header ($fp, $t, $c, $b, $subject, $more_headers) { global $REMOTE_ADDR, $SERVER_NAME, $REMOTE_PORT; global $data_dir, $username, $domain, $version, $useSendmail; - global $default_charset; + global $default_charset, $HTTP_VIA, $HTTP_X_FORWARDED_FOR; // Storing the header to make sure the header is the same // everytime the header is printed. @@ -145,7 +145,13 @@ $message_id .= time() . "@" . $SERVER_NAME .">"; /* Make an RFC822 Received: line */ - $header = "Received: from $REMOTE_ADDR by $SERVER_NAME with HTTP; "; + $received_from = "$REMOTE_ADDR"; + if (isset($HTTP_VIA) || isset ($HTTP_X_FORWARDED_FOR)) { + if ($HTTP_X_FORWARDED_FOR == "") + $HTTP_X_FORWARDED_FOR = "unknown"; + $received_from .= " (proxying for $HTTP_X_FORWARDED_FOR)"; + } + $header = "Received: from $received_from by $SERVER_NAME with HTTP; "; $header .= "$date\r\n"; /* Insert the rest of the header fields */ -- 2.25.1