Server IP : 85.214.239.14 / Your IP : 3.145.171.99 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/cwd/usr/share/perl5/Amavis/ |
Upload File : |
# SPDX-License-Identifier: GPL-2.0-or-later package Amavis::UnmangleSender; use strict; use re 'taint'; BEGIN { require Exporter; use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION); $VERSION = '2.412'; @ISA = qw(Exporter); @EXPORT_OK = qw(&first_received_from &oldest_public_ip_addr_from_received); } use subs @EXPORT_OK; use Amavis::Conf qw(:platform c cr ca); use Amavis::Lookup qw(lookup lookup2); use Amavis::Lookup::IP qw(normalize_ip_addr); use Amavis::rfc2821_2822_Tools qw(split_address parse_received fish_out_ip_from_received); use Amavis::Util qw(ll do_log unique_list); # Obtain and parse the first entry (oldest) in the 'Received:' header field # path trace - to be used as the value of a macro %t in customized messages # sub first_received_from($) { my $msginfo = $_[0]; my $first_received; my $fields_ref = parse_received($msginfo->get_header_field_body('received')); # last if (exists $fields_ref->{'from'}) { $first_received = join(' ', unique_list(grep(defined($_), @$fields_ref{qw(from from-tcp from-com)}))); do_log(5, "first_received_from: %s", $first_received); } $first_received; } # Try to extract sender's IP address from the Received trace. # Search bottom-up, use the first public IP address from the trace. # sub oldest_public_ip_addr_from_received($) { my($msginfo) = @_; my $received_from_ip; my $ip_trace_ref = $msginfo->ip_addr_trace_public; # top-down trace $received_from_ip = $ip_trace_ref->[-1] if $ip_trace_ref; # last is oldest do_log(5, "oldest_public_ip_addr_from_received: %s", $received_from_ip) if defined $received_from_ip; $received_from_ip; } 1;